﻿///<jscompress sourcefile="jquery.calculate.js" />
/**
 * @filename jquery.calculate.js
 * @author Aniu[2014-07-14 11:05]
 * @update Aniu[2015-10-12 14:18]
 * @version v1.1
 * @description none
 */

;!(function(window, document, $, undefined){
	$.fn.calculate = function(o){
	    o = $.extend({
	    	init:false,
	        isNull:false,
	        count:$.noop,
	        total:$.noop,
	        max:$.noop
	    }, o||{});
	    var result = function(num, val, that){
	        (o.max !== null && val > parseInt(o.max(that))) && (val = parseInt(o.max(that)));
	        num.val(val);
	        o.count(val, that, o.init);
	        o.init && o.total();
	    }
	
	    return this.each(function(){
	        var that = $(this),
	            less = that.find('.j-less'),
	            num = that.find('.j-num'),
	            value = num.val(),
	            add = that.find('.j-add'),
	            max = parseInt(o.max(that)),
	            flag = false;
	        if(max == value){
	        	add.addClass('s-dis');
	        }
	        if(o.isNull){
	        	if(value == '0'){
	        		less.addClass('s-dis');
	        	}
	        }
	        else{
	        	if(value == '1'){
	        		less.addClass('s-dis');
	        	}
	        }
	        less.click(function(){
	        	if(!less.hasClass('s-dis')){
	        		var val = num.val();
	                if(parseInt(val).toString() === 'NaN'||val<=0){
	    				val = o.isNull ? 0 : 1;
	    			}
	                if(val > (o.isNull ? 0 : 1)){
	                	val -= 1;
	                	add.removeClass('s-dis');
	                }
	                else{
	                	less.addClass('s-dis');
	                }
	                o.init = true;
	                result(num, val, that);
	        	}
	        });
	        add.click(function(){
	        	if(!add.hasClass('s-dis')){
		            var val = num.val();
		            parseInt(val).toString() === 'NaN' && (val = 0);
		            if(max !== 'NaN'){
		            	if(parseInt(val)===max){
		            		val = parseInt(val);
		            	}else{
		            		val = parseInt(val) + 1;
		            		if(val===max){
		            			add.addClass('s-dis');
		            		}
		            		less.removeClass('s-dis');
		            	}
		            }else{
		            	val = parseInt(val) + 1;
		            	less.removeClass('s-dis');
		            }
		            o.init = true;
		            result(num, val, that);
	        	}
	        });
	        num.keydown(function(e){
	        	var code = e.keyCode;
	        	if((code>=48&&code<=57) || (code>=96&&code<=105) || code === 8){
	        		return true;
	        	}
	        	return false;
	        });
	        num.keyup(function(){
	            var val = num.val();	
	        	if(flag){
	                val = (isNaN(val) || val<=0) ? (o.isNull ? 0 : 1) : ((val = parseInt(val)).toString() == 'NaN' ? 1 : val);
	            	o.init = true;
	            }
	            flag = true;
	            result(num, val, that);
	        }).keyup();
	    });
	}
})(this, document, jQuery);
///<jscompress sourcefile="jquery.copy.js" />
/**
 * @filename jquery.copy.js
 * @author Aniu[2015-02-10 16:35]
 * @update Aniu[2015-03-06 14:12]
 * @version v1.2
 * @description none
 */
 
;!(function(window, document, $, undefined){
	$.fn.copy = function(o){
		o = $.extend({
	        text:null
	    }, o||{});
		return this.each(function(){
			var that = $(this), text = o.text, data;
	        that.on('click', function(){
	            if(!text){
	                alert('没有需要复制的文本。');
	                return;
	            }
	            if(typeof text == 'object'){
	                if(text.is(':text')){
	                    data = text.val();
	                }
	                else{
	                    data = text.text();
	                }
	            }
	            else{
	                data = text;
	            }
	            try{
	                if(window.clipboardData.setData('text', data)){
	                    alert('复制成功。');
	                }
	                else{
	                    alert('复制失败，请重试。');
	                }
	            }
	            catch(e){
	                alert('您使用的浏览器无法使用此功能，请使用Ctrl+C手动复制。');
	                typeof text == 'object' && text.select();
	            }
	        });
		});
	}
})(this, document, jQuery);
///<jscompress sourcefile="jquery.countdown.js" />
/**
 * @filename jquery.countdown.js
 * @author Aniu[2015-08-05 21:31]
 * @update Aniu[2015-10-16 15:19]
 * @version v1.2
 * @description 倒计时
 */
 
;!(function(window, document, $, undefined){
    $.fn.countdown = function(o){
        o = $.extend({
            /**
             * @func 倒计时时长
             * @type <Number>
             * @desc 单位/毫秒
             */
            time:60000,
            /**
             * @func 目标元素，比如获取验证码的输入框jq对象
             * @type <Object, Function>
             * @return <Object>
             * @param me <JQuery Object> 调用当前组件的jq对象
             */
            target:null,
            /**
             * @func ajax配置
             * @type <Object, Function>
             * @return <Object>
             * @param me <JQuery Object> 调用当前组件的jq对象
             * @param target <JQuery Object> 目标元素
             */
            ajax:null,
            /**
             * @func 是否点击事件后执行
             * @type <Boolean>
             * @desc 有些情况显示几秒后跳转到某页
             */
            isEvent:true,
            /**
             * @func 倒计时进行中的后缀文本
             * @type <String, Function>
             * @param time <Number> 倒计时秒数
             */
            text:'秒后重新获取验证码',
            /**
             * @func 倒计时开始时执行函数
             * @type <Function>
             * @return <Undefined,  Boolean> 返回false将不执行倒计时
             * @param me <JQuery Object> 调用当前组件的jq对象
             * @param target <JQuery Object> 目标元素
             */
            startCallback:$.noop,
            /**
             * @func 倒计时结束时执行函数
             * @type <Function>
             * @return <Undefined>
             * @param me <JQuery Object> 调用当前组件的jq对象
             * @param target <JQuery Object> 目标元素
             */
            endCallback:$.noop
        }, o||{});
        return this.each(function(){
            var that = this, 
                me = $(that), 
                isipt = that.nodeName === 'INPUT',
                text = me[isipt?'val':'text'](),
                target = typeof o.target === 'function' ? o.target(me) : o.target,
                timer = null,
                time = o.time,
                temp = null,
                run = function(){
                    temp = (function(){
                        if(typeof o.text === 'function'){
                            return o.text(time/1000);
                        }
                        return time/1000+o.text;
                    })();
                    me[isipt?'val':'text'](temp);
                    timer = setTimeout(function(){
                        if(time<=0 || me.data('stop') == true){
                            me.removeClass('s-dis').data('stop', false);
                            clearTimeout(timer);
                            me[isipt?'val':'text'](text);
                            time = o.time;
                            o.endCallback(me, target);
                            return;
                        }
                        time -= 1000;
                        run();
                    }, 1000);
                }
            if(o.isEvent === true){
                me.click(function(){
                    if(!me.hasClass('s-dis')){
                        if(o.startCallback(me, target) === false){
                            return;
                        }
                        me.addClass('s-dis').data('stop', false);
                        if(o.ajax !== null){
                            $.ajax(typeof o.ajax === 'function' ? o.ajax(me, target) : o.ajax);
                        }
                        run();
                    }
                });
            }
            else{
                run();
            }
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.flotage.js" />
/**
 * @filename jquery.flotage.js
 * @author Aniu[2014-12-08 08:46]
 * @update Aniu[2014-12-08 08:46]
 * @version v1.1
 * @description 漂浮物组件
 */
 
;!(function(window, document, $, undefined){ 
    $.fn.flotage = function(o){
        o = $.extend({
            count:25,
            delay:1000,
            speed:12400,
            window:$(window),
            initStyle:{
                color:'#fff'
            },
            endStyle:null,
            createHtml:function(){
                return '<span>&#10052;</span>';
            },
            handleCallback:function(item){
                var rand = Math.ceil(Math.random() * 16) + 12;
                item.css({fontSize:rand});
            }
        }, o||{});
        return this.each(function(){
            var target = $(this).css({position:'relative'}),
                count = o.count - 1,
                width  = (o.window && o.window.width()) || target.width(),
                height = (o.window && o.window.height()) || target.height(),
                initStyle = $.extend({position:'absolute', top:-50, zIndex:99999, opacity:1}, o.initStyle),
                endStyle = $.extend({top:height, opacity:0}, o.endStyle),
                html = '',
                items, i;
                
            for(i=0; i<=count; i++){
                html += o.createHtml();
            }
            items = $(html).appendTo(target).css(initStyle);
            
            function handleItem(index) {
                var item = items.eq(index).css(initStyle),
                    itemWidth, randWidth;
                o.handleCallback(item);
                itemWidth = item.width();
                randWidth = Math.floor(Math.random() * width);
                if ((randWidth + itemWidth) >= width) {
                    randWidth = randWidth - itemWidth;
                }
                item.css({left:randWidth}).animate(endStyle, o.speed);
            }
            
            function running(){
                var i = 0;
                setTimeout(function call(){
                    handleItem(i);
                    i = ++i%count;
                    setTimeout(call, o.delay);
                }, 0);
            }
            running();
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.layer.js" />
/**
 * @filename jquery.layer.js
 * @author Aniu[2014-07-11 14:01]
 * @update Aniu[2016-04-15 14:05]
 * @version v3.3.3
 * @description 弹出层组件
 */

;!(function(window, document, $, undefined){
    var Layer = function(options){
        var that = this;
        that.options = {
            //宽度, 整数
            width:0,
            //高度，整数或者auto
            height:'auto',
            //最大高度，height设置为auto时可以使用
            maxHeight:0,
            //内容，字符串或者jQuery对象
            content:'',
            //1.自定义皮肤主题；2.layer标识，隐藏特定的layer：layerHide(theme);
            theme:'',
            //最大尺寸距离窗口边界边距
            padding:50,
            //弹出层容器，默认为body
            container:'body',
            //是否淡入方式显示
            isFadein:true,
            //是否开启弹出层动画
            isAnimate:true,
            //是否可以移动
            isMove:true,
            //是否有遮罩层
            isMask:true,
            //点击遮罩层是否关闭弹出层
            isClickMask:false,
            //是否有移动遮罩层
            isMoveMask:false,
            //是否能被laierHide()方法关闭，不传参数
            isClose:true,
            //是否居中
            isCenter:false,
            //是否自适应最大尺寸显示
            isMaxSize:false,
            //是否是ui提示层
            isTips:false,
            //点击layer是否置顶
            isSticky:false,
            //是否固定弹出层
            isFixed:false,
            //标题
            title:{
                enable:true,
                text:''
            },
            //载入浮动框架
            iframe:{
                enable:false,
                cache:false,
                //跨域无法自适应高度
                src:''
            },
            //显示位置
            offset:{
                //是否基于前一个层进行偏移
                isBasedPrev:false,
                top:null,
                left:null
            },
            //小箭头，方向：top right bottom left
            arrow:{
                enable:false,
                dir:'top'
            },
            close:{
                enable:true,
                text:'×',
                /**
                 * @func 弹出层关闭前执行函数，
                 * @param main:$('.ui-layer-main')
                 * @param index:弹出层索引
                 * @param event 事件对象
                 */
                callback:null
            },
            //确认按钮，回调函数return true才会关闭弹层
            confirm:{
                enable:false,
                text:'确定',
                /**
                 * @func 回调函数
                 * @param main:$('.ui-layer-main')
                 * @param index:弹出层索引
                 * @param button:当前触发按钮
                 * @param event:事件对象
                 */
                callback:null
            },
            //取消按钮
            cancel:{
                enable:false,
                text:'取消',
                /**
                 * @func 回调函数
                 * @param main:$('.ui-layer-main')
                 * @param index:弹出层索引
                 * @param event 事件对象
                 */
                callback:null
            },
            //按钮配置，会覆盖confirm和cancel
            button:null,
            /**
             * @func 弹出层显示时执行
             * @param main:$('.ui-layer-main')
             * @param index:弹出层索引
             */
            onShowEvent:null,
            /**
             * @func 弹出层关闭时执行
             * @param main:$('.ui-layer-main')
             * @param index:弹出层索引
             */
            onHideEvent:null,
            /**
             * @func 弹出层大小、位置改变后执行函数
             * @param main:$('.ui-layer-main')
             * @param index:弹出层索引
             */
            onResizeEvent:null,
            /**
             * @func window窗口改变大小时执行函数
             * @param layer:$('.ui-layer')
             * @param width:窗口宽度
             * @param height:窗口高度
             * @param event 事件对象
             */
            onWinRisizeEvent:null,
            /**
             * @func window窗口滚动时执行函数
             * @param layer:$('.ui-layer')
             * @param scrollTop:窗口滚动高度
             * @param event 事件对象
             */
            onWinScrollEvent:null,
            /**
             * @func 遮罩层点击回调函数
             * @param layer:$('.ui-layer')
             * @param mask 遮罩层选择器
             * @param event 事件对象
             */
            onMaskClick:null
        }
        that.options = $.extend(true, that.options, Layer.config, options||{});
        that.size = {
            width:0,
            height:0
        }
        that.index = Layer.index++;
        that.eventArray = [];
        Layer.zIndex++;
        return Layer.listArray[that.index] = that.init();
    }, win = $(window), doc = $(document);
    Layer.index = 0;
    Layer.zIndex = 10000;
    Layer.bsie6 = !!window.ActiveXObject && !window.XMLHttpRequest;
    Layer.listArray = [];
    Layer.mask = null;
    Layer.config = {};
    Layer.getSize = function(selector, dir, attr){
        var size = 0;
        attr = attr || 'border';
        dir = dir || 'tb';
        if(attr === 'all'){
            return Layer.getSize(selector, dir) + Layer.getSize(selector, dir, 'padding');
        }
        var arr = [{
            border:{
                lr:['LeftWidth', 'RightWidth'],
                tb:['TopWidth', 'BottomWidth']
            }
        }, {
            padding:{
                lr:['Left', 'Right'],
                tb:['Top', 'Bottom']
            }
        }];
        $.each(arr, function(key, val){
            if(val[attr]){
                $.each(val[attr][dir], function(k, v){
                    var value = parseInt(selector.css(attr+v));
                    size += isNaN(value) ? 0 : value;
                });
            }
        });
        return size;
    }
    /**
     * @func 弹出层居中、高度改变
     * @param index:弹出层索引或者标识
     * @desc 可在框架内操作父窗口弹出层:
     * @desc top.layerResize(document.layer.index)
     * @desc parent.layerHide(document.layer.index)
     */
    window.layerResize = function(index){
        if(typeof index === 'number'){
            Layer.listArray[index].layerResize();
        }
        else if(typeof index === 'string'){
            $.each(Layer.listArray, function(key, val){
                if(val && val.options.theme == index){
                    val.layerResize();
                }   
            });
        }
        else{
            $.each(Layer.listArray, function(key, val){
                if(val && val.options.isCenter == true){
                    val.layerResize();
                }   
            });
        }
    }
    /**
     * @func 移除弹出层
     * @param index:弹出层索引或者标识(theme)
     */
    window.layerHide = function(index){
        if(typeof index === 'number'){
            Layer.listArray[index] && Layer.listArray[index].hide();
        }
        else if(typeof index === 'string'){
            $.each(Layer.listArray, function(key, val){
                val && (val.options.theme == index && val.hide());    
            });
        }
        else{
            $.each(Layer.listArray, function(key, val){
                val && (val.options.isClose == true && val.hide());   
            });
        }
    }
    /**
     * @func 弹出层全局配置
     * @param options <JSON Object> 配置属性
     */
    window.layerConfig = function(options){
        $.extend(true, Layer.config, $.isPlainObject(options) ? options : {});
    }
    
    Layer.prototype = {
        constructor:Layer,
        version:'3.3.3',
        width:410,
        height:220,
        offset:{
            top:0,
            left:0
        },
        title:'温馨提示',
        init:function(){
            var that = this, options = that.options;
            that.wrap = win;
            if(typeof options.container === 'string'){
                options.container = $(options.container||'body');
            }
            if(options.container.get(0) === undefined){
                options.container = $('body');
            }
            if(options.container.get(0).tagName !== 'BODY'){
                options.isFixed = false;
                that.wrap = options.container.css({position:'relative'});
            }
            that.createHtml().show().bindClick();
            if(options.isMove === true && options.title.enable === true){
                that.bindMove();
            }
            if(typeof options.onWinRisizeEvent === 'function'){
                that.bindEvent(win, 'resize', function(e){
                    options.onWinRisizeEvent(that.layer, that.wrap.width(), that.wrap.height(), e);
                });
            }
            if(typeof options.onWinScrollEvent === 'function'){
                that.bindEvent(win, 'scroll', function(){
                    options.onWinScrollEvent(that.layer, win.scrollTop(), e);
                });
            }
            return that;
        },
        createHtml:function(){
            var that = this, options = that.options,
                width = options.width ? options.width : that.width,
                height = options.height ? options.height : that.height,
                theme = options.theme ? ' t-layer-'+options.theme : '',
                tips = options.isTips === true ? (function(){
                    options.arrow.enable = true; 
                    options.isMove = options.isMask = options.title.enable = options.isCenter = options.isMaxSize = false;
                    width = 'auto'; 
                    return ' ui-layer-tips';
                })() : '',
                html = '<div class="ui-layer'+ theme + tips +'" style="z-index:'+ Layer.zIndex +';">',
                title = oHeight = oWidth = '';
                html += '<div class="ui-layer-box">';
            if(options.close.enable === true){
                html += '<span class="ui-layer-button ui-layer-close" btnid="close">'+ options.close.text +'</span>';
            }
            if(options.arrow.enable === true){
                html += '<span class="ui-layer-arrow ui-layer-arrow-'+ options.arrow.dir +'"><b></b><i></i></span>';
            }
            if(options.title.enable === true){
                title = options.title.text ? options.title.text : that.title;
                html += '<div class="ui-layer-title"><span>'+ title +'</span></div>';
            }
            html += '<div class="ui-layer-body"><div class="ui-layer-main">';
            if(options.iframe.enable === true){
                html += that.createIframe();
            }
            else{
                if(typeof options.content === 'string'){
                    html += options.content;
                }
            }
            html += '</div></div>';
            if(!$.isPlainObject(options.button)){
                options.button = {};
            }
            var btns = ['confirm', 'cancel', 'close'];
            $.each(btns, function(key, btnid){
                var optsBtn = options[btnid], btnsBtn = options.button[btnid];
                if(optsBtn.enable === true){
                    if(typeof btnsBtn !== 'undefined'){
                        options.button[btnid] = $.extend(optsBtn, btnsBtn);
                    }
                    else{
                        options.button[btnid] = optsBtn;
                    }
                }
            });
            if(!$.isEmptyObject(options.button)){
            	var foot = '';
                $.each(options.button, function(btnid, opts){
                    if(btnid === 'close'){
                        return true;
                    }
                    if(btnid ==='confirm' || btnid ==='cancel'){
                        opts.text = opts.text || (btnid === 'confirm' ? '确定' : '取消');
                    }
                    else{
                        opts.text = opts.text || btnid;
                    }
                    options.button[btnid].text = opts.text;
                    foot += '<span class="ui-layer-button ui-layer-'+ btnid +'" btnid="'+ btnid +'">'+ opts.text +'</span>';
                });
                if(foot){
                	html += '<div class="ui-layer-foot">' + foot +'</div>';
                }
            }
            html += '</div></div>';
            that.layer = $(html).appendTo(options.container);
            if(typeof options.content === 'object'){
                that.layer.find('.ui-layer-main').html(options.content);
            }
            if(options.iframe.enable === true){
                that.iframe = that.layer.find('iframe[name="layer-iframe-'+ that.index +'"]');
            }
            oHeight = Layer.getSize(that.layer, 'tb', 'all');
            oWidth = Layer.getSize(that.layer, 'lr', 'all');
            if(options.isMaxSize !== true){
                height = height - oHeight;
                width = width - oWidth;
            }
            else{
                options.isCenter = true;
                height = that.wrap.outerHeight() - options.padding - oHeight;
                width = that.wrap.outerWidth() - options.padding - oWidth;
                options.height = 'auto';
            }
            if(options.height === 'auto' && options.maxHeight > 0 && that.layer.outerHeight() > options.maxHeight){
                options.height = options.maxHeight;
                height = options.height - oHeight;
            }
            that.layer.css({width:width, height:height});
            return that;
        },
        createIframe:function(){
            var that = this, options = that.options, src = options.iframe.src;
            if(options.iframe.cache === false){
                var flag = '?_=';
                if(src.indexOf('?') !== -1){
                    flag = '&_=';
                }
                src += flag+new Date().getTime();
            }
            return '<iframe frameborder="0" name="layer-iframe-'+ that.index +'" id="layer-iframe-'+ that.index +'" scroll="hidden" style="width:100%;" src="'+ src +'" onload="layerResize('+ that.index +')"></iframe>';
        },
        createMoveMask:function(){
            var that = this, options = that.options, zIndex = Layer.zIndex + 1, theme = options.theme ? ' t-movemask-'+options.theme : '';
            return $('<div class="ui-layer-movemask'+ theme +'" style="z-index:'+ zIndex +';"></div>').appendTo(options.container);
        },
        bindMove:function(){
            var that = this, options = that.options, layer = that.layer, title = that.layer.find('.ui-layer-title'), isMove = false, x, y, mx, my;
            that.bindEvent(title, 'mousedown', function(e){
                isMove = true;
                that.setzIndex();
                if(options.isMoveMask === true){
                    layer = that.moveMask = that.createMoveMask();
                    if(options.isFixed === true && !Layer.bsie6){
                        layer.css('position', 'fixed');
                    }
                    layer.css({
                        width:that.size.width - Layer.getSize(layer, 'lr'),
                        height:that.size.height - Layer.getSize(layer),
                        top:that.offset.top,
                        left:that.offset.left
                    });
                }
                $(this).css({cursor:'move'});
                x = e.pageX - that.offset.left;
                y = e.pageY - that.offset.top;
                return false;
            });
            that.bindEvent(doc, 'mousemove', function(e){
                var width = $(this).width(), height = $(this).height();
                if(isMove){
                    mx = e.pageX - x;
                    my = e.pageY - y;
                    mx < 0 && (mx = 0);
                    my < 0 && (my = 0);
                    mx + that.size.width > width && (mx = width - that.size.width);
                    my + that.size.height > height && (my = height - that.size.height);
                    that.offset.top = my;
                    that.offset.left = mx;
                    layer.css({top:my, left:mx});
                    return !isMove;
                }
            });
            that.bindEvent(doc, 'mouseup', function(){
                if(isMove){
                    isMove = false;
                    title.css({cursor:'default'});
                    mx = mx || that.offset.left;
                    my = my || that.offset.top;
                    if(options.isMoveMask === true){
                        !that.layer.is(':animated') && that.layer.animate({top:my, left:mx}, options.isAnimate === true ? 450 : 0);  
                        layer.remove();
                    }
                    if(Layer.bsie6 && options.isFixed === true){
                        that.offset.winTop = my - win.scrollTop();
                        that.offset.winLeft = my - win.scrollLeft();
                    }
                }
            });
        },
        bindBtnClick:function(){
            var that = this, layer = that.layer, 
                options = that.options,
                main = layer.find('.ui-layer-main'),
                button = layer.find('.ui-layer-button');
            layer.on('click', function(){
               options.isSticky === true && that.setzIndex();
            });
            button.on('click', function(e){
                var me = $(this), btnid = me.attr('btnid'), callback = options.button[btnid].callback;
                if(btnid === 'confirm'){
                    if(typeof callback === 'function' && callback(main, that.index, me, e) === true){
                        that.hide();
                    }
                }
                else{
                    if(typeof callback !== 'function' || (typeof callback === 'function' && callback(main, that.index, me, e) !== false)){
                        that.hide();
                    }
                }
                return false;
            });
        },
        bindClick:function(){
            var that = this;
            $.each(Layer.listArray, function(key, val){
                if(val && val !== that){
                    val.isClick = true;
                }
            });
        },
        bindEvent:function(target, eventType, callback, EventInit){
            var that = this;
            target.bind(eventType, callback);
            EventInit === true && target[eventType]();
            that.eventArray.push({
                target:target,
                eventType:eventType,
                callback:callback
            });
        },
        unbindEvent:function(){
            var that = this;
            $.each(that.eventArray, function(key, val){
                val && val.target.unbind(val.eventType, val.callback);  
            });
            that.eventArray = null;
        },
        setzIndex:function(){
            var that = this, layer = that.layer, i;
            if(that.isClick){
                that.isClick = false;
                layer.css({zIndex:++Layer.zIndex});
                that.bindClick();
            }
        },
        layerResize:function(){
            var that = this, options = that.options, layer = that.layer, bodyHeight, contentHeight, height, box = layer.children('.ui-layer-box'), 
                head = box.children('.ui-layer-title'), body = box.children('.ui-layer-body'), main = body.children('.ui-layer-main'), 
                winStop = that.wrap.scrollTop(), winSleft = that.wrap.scrollLeft(), foot = box.children('.ui-layer-foot'), headHeight = head.outerHeight(), 
                footHeight = foot.outerHeight(), ptb = Layer.getSize(layer, 'tb', 'padding'), bbd = Layer.getSize(body), bl = Layer.getSize(layer), 
                bb = Layer.getSize(box), blt = Layer.getSize(layer, 'lr'), extd = {}, speed = 400, wheight = that.wrap.outerHeight() - options.padding, 
                wwidth = that.wrap.outerWidth() - options.padding, isiframe = typeof that.iframe === 'object', outerHeight = headHeight + footHeight + ptb + bbd + bl + bb;
            
            if(isiframe){
                var iframeDoc = that.iframe.contents(), 
                    iframeHtml = iframeDoc.find('html').css({overflow:'auto'});
                iframeDoc[0].layer = {index:that.index, target:that.layer}; //iframe没有加载完获取不到
                contentHeight = iframeHtml.children('body').outerHeight();
            }
            else{
                contentHeight = main.outerHeight();
            }
            
            if(options.height === 'auto' && options.maxHeight > 0 && that.maxBodyHeight !== undefined && contentHeight > that.maxBodyHeight){
                that.size.height = options.height = options.maxHeight;
                body.height(that.maxBodyHeight);
            }
            
            if(isiframe){
                if(options.height === 'auto'){
                    contentHeight += outerHeight;
                    if(contentHeight > wheight){
                        that.size.height = wheight;
                    }
                    else{
                        that.size.height = contentHeight;
                    }
                }
            }
            else{
                if(options.height === 'auto'){
                    contentHeight += outerHeight;
                    if(contentHeight > wheight){
                        that.size.height = wheight;
                        body.css({'overflow-y':'auto', 'overflow-x':'auto'});
                    }
                    else{
                        that.size.height = contentHeight;
                        body.css({'overflow':'visible'});
                    }
                }
                else{
                    if(contentHeight > body.height()){
                        body.css({'overflow-y':'auto', 'overflow-x':'auto'});
                    }
                    else{
                        body.css({'overflow':'visible'});
                    }
                }
            }
            
            if(options.isMaxSize === true){
                that.size.width = wwidth - blt;
                that.size.height = wheight;
                extd.width = that.size.width - Layer.getSize(layer, 'lr', 'padding');
                speed = 0;
            }
            
            if(options.isFixed === true && !Layer.bsie6){
                winStop = 0;
            }
            
            that.offset.top = (that.wrap.outerHeight() - that.size.height) / 2 + winStop;
            if(options.isCenter === true){
                that.offset.left = (that.wrap.outerWidth() - that.size.width) / 2 + winSleft;
            }
            height = that.size.height - ptb - bl;
            bodyHeight = height - bb - headHeight - footHeight - bbd;
            body.stop(true, false).animate({height:bodyHeight}, options.isAnimate === true ? speed : 0);
            isiframe && that.iframe.stop(true, false).animate({height:bodyHeight}, options.isAnimate === true ? speed : 0);
            layer.stop(true, false).animate($.extend({top:that.offset.top, left:that.offset.left, height:height}, extd), options.isAnimate === true ? speed : 0, function(){
                if(Layer.bsie6 && options.isFixed === true){
                    that.offset.winTop = that.offset.top - winStop;
                    that.offset.winLeft = that.offset.left - winSleft;
                }
                typeof options.onResizeEvent === 'function' && options.onResizeEvent(main, that.index);
            });
        },
        show:function(){
            var that = this, options = that.options, layer = that.layer, bodyHeight, winStop = that.wrap.scrollTop(), winSleft = that.wrap.scrollLeft(),
                theme = options.theme ? ' t-mask-'+options.theme : '', showType = options.isFadein === true ? 'fadeIn' : 'show',
                box = layer.children('.ui-layer-box'), head = box.children('.ui-layer-title'), body = box.children('.ui-layer-body'),
                main = body.children('.ui-layer-main'), foot = box.children('.ui-layer-foot');
            if(options.isFixed === true && !Layer.bsie6){
                winStop = 0;
                winSleft = 0;
                layer.css('position', 'fixed');
            }
            
            that.size.width = layer.outerWidth();
            that.size.height = layer.outerHeight();
            if(layer.outerHeight() > that.wrap.outerHeight() - options.padding){
                that.size.height = layer.height(that.wrap.outerHeight() - options.padding - Layer.getSize(layer, 'tb', 'all')).outerHeight();
                body.css({'overflow-y':'auto', 'overflow-x':'auto'});
            }
            else{
                body.css({'overflow':'visible'});
            }
            that.offset.top = parseInt(options.offset.top);
            that.offset.left = parseInt(options.offset.left);
            that.offset.top = (isNaN(that.offset.top) ? ((that.wrap.outerHeight() - that.size.height) / 2) : that.offset.top) + winStop;
            that.offset.left = (isNaN(that.offset.left) ? ((that.wrap.outerWidth() - that.size.width) / 2) : that.offset.left) + winSleft;
            if(!!that.index && options.offset.isBasedPrev === true){
                var index = that.index - 1, prevLayer = Layer.listArray[index];
                that.offset.top = prevLayer.offset.top + 10;
                that.offset.left = prevLayer.offset.left + 10;
            }
            if(options.isMask === true){
                if(!Layer.mask || (that.wrap !== win && !that.mask)){
                    if(that.wrap !== win){
                        that.mask = $('<div class="ui-layer-mask'+ theme +'"><div></div></div>').appendTo(options.container);
                        that.mask.css({position:'absolute'});
                    }
                    else{
                        Layer.mask = $('<div class="ui-layer-mask'+ theme +'"><div></div></div>').appendTo(options.container);
                    }
                    that.bindEvent(that.mask||Layer.mask, 'click', function(e){
                        typeof options.onMaskClick === 'function' && options.onMaskClick(layer, $(this), e);
                        options.isClickMask === true && that.hide();
                    });
                    if(Layer.bsie6){
                        that.bindEvent(win, 'resize', function(){
                            (that.mask||Layer.mask).css({position:'absolute', width:that.wrap.outerWidth(), height:that.wrap === win ? doc.height() : that.wrap.outerHeight()});
                        }, true);
                    }
                    (that.mask||Layer.mask)[showType]();
                }
            }
            if(Layer.bsie6 && options.isFixed === true){
                that.offset.winTop = that.offset.top - winStop;
                that.offset.winLeft = that.offset.left - winSleft;
                that.bindEvent(win, 'scroll', function(){
                    var css = {
                        top:that.offset.winTop + win.scrollTop(),
                        left:that.offset.winLeft + win.scrollLeft()
                    }
                    that.offset.top = css.top;
                    that.offset.left = css.left;
                    that.moveMask && that.moveMask.css(css);
                    that.layer.css(css);
                });
            }
            layer.css({margin:0, top:that.offset.top, left:that.offset.left})[showType]();
            var innerHeight = Layer.getSize(box, 'tb', 'all') +
                              head.outerHeight() + foot.outerHeight() + 
                              Layer.getSize(body, 'tb', 'all');
            bodyHeight = layer.height() - innerHeight;
            if(options.maxHeight > 0 && options.maxHeight < that.wrap.outerHeight() - options.padding){
                that.maxBodyHeight = options.maxHeight - Layer.getSize(layer, 'tb', 'all') - innerHeight;
            }
            body.css({height:bodyHeight});
            if(options.height > 0 && main.outerHeight() > body.height()){
                body.css({'overflow-y':'auto', 'overflow-x':'auto'});
            }
            if(options.iframe.enable === true){
                body.css({overflow:'hidden'});
            }
            layer.css({overflow:'visible'});
            that.bindBtnClick();
            if(options.isCenter === true){
                that.bindEvent(win, 'resize', function(){
                    that.layerResize();
                });
                if(Layer.bsie6){
                    that.layerResize();
                }
            }
            if(typeof options.onShowEvent === 'function'){
                options.onShowEvent(main, that.index);
            }
            return that;
        },
        hide:function(){
            var that = this, options = that.options, layer = that.layer, main = layer.find('.ui-layer-main'), xMask = true;
            layer.remove();
            that.unbindEvent();
            delete Layer.listArray[that.index];
            Layer.index--;
            Layer.zIndex--;
            $.each(Layer.listArray, function(key, val){
                if(val && val.options.isMask == true && val.wrap === win){
                    return (xMask = false);
                }   
            });
            if(xMask && Layer.mask){
                Layer.mask.remove();
                Layer.mask = null;
            }
            if(that.mask){
                that.mask.remove();
            }
            if(typeof options.onHideEvent === 'function'){
                options.onHideEvent(main, that.index);
                main.remove();
            }
        }
    }
    
    $.extend({
        layer:function(options){
            return new Layer(options);
        }
    });
    $.layer.alert = function(message, title, width, height){
        return new Layer({
            content:message,
            title:{
                text:title
            },
            width:width,
            height:isNaN(height) ? 'auto' : height,
            cancel:{
                enable:true,
                text:'确定'
            }
        });
    }
    $.layer.confirm = function(message, callback, title, width, height){
        return new Layer({
            content:message,
            title:{
                text:title
            },
            width:width,
            height:isNaN(height) ? 'auto' : height,
            confirm:{
                enable:true,
                callback:callback
            },
            cancel:{
                enable:true
            }
        });
    }
    $.layer.iframe = function(src, title, width, height){
        return new Layer({
            width:width,
            height:isNaN(height) ? 'auto' : height,
            isFadein:false,
            iframe:{
                enable:true, 
                src:src
            },
            title:{
                text:title
            }
        });
    }
    $.layer.tips = function(message, dir, offset, callback){
        return new Layer({
            content:message,
            isTips:true,
            close:{
                enable:false
            },
            arrow:{
                dir:dir ? dir : 'top'
            },
            offset:{
                top:offset && offset.top ? offset.top : 0,
                left:offset && offset.left ? offset.left : 0
            },
            onShowEvent:callback
        });
    }
    $.layer.showmsg = function(msg, target, dir, ofs){
        var offset = target.offset();
        clearTimeout($.layer.showmsg.timer);
        ofs = $.extend({
            top:-3,
            left:10
        }, ofs||{});
        if(dir == 'left'){
            offset.left = offset.left + target.width() + ofs.left
        }
        else{
            offset.top = offset.top + target.height() + ofs.top;
            offset.left += ofs.left;
        }
        offset.top -= $(window).scrollTop();
        layerHide('showmsg');
        $.layer({
            content:'<p style="padding:6px;">'+ msg +'</p>',
            isTips:true,
            isClose:false,
            theme:'showmsg',
            close:{
                enable:false
            },
            arrow:{
                dir:dir ? dir : 'top'
            },
            offset:{
                top:offset.top,
                left:offset.left
            },
            onShowEvent:function(main, index){
                var layer = main.parents('.ui-layer'), speed = 150;
                layer.queue('queue', [
                    function(){
                        layer.animate({left:'-=20px'}, speed).dequeue('queue');
                    },
                    function(){
                        layer.animate({left:'+=30px'}, speed).dequeue('queue');
                    },
                    function(){
                        layer.animate({left:'-=20px'}, speed).dequeue('queue');
                    },
                    function(){
                        layer.animate({left:'+=10px'}, speed, function(){
                            $.layer.showmsg.timer = setTimeout(function(){
                                layerHide('showmsg');
                            }, 1500);
                        }).dequeue('queue');
                    }
                ]).dequeue('queue');
            }
        });
    }
    $.layer.showmsg.timer = null;
})(this, document, jQuery);
///<jscompress sourcefile="jquery.lazyload.js" />
/*!
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2015 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.9.7
 *
 */

(function($, window, document, undefined) {
    var $window = $(window);

    $.fn.lazyload = function(options) {
        var elements = this;
        var $container;
        var settings = {
            threshold       : 100,
            failure_limit   : 0,
            event           : "scroll",
            effect          : "show",
            container       : window,
            data_attribute  : "src",
            skip_invisible  : false,
            appear          : null,
            load            : null,
            placeholder     : ""
        };

        function update() {
            var counter = 0;

            elements.each(function() {
                var $this = $(this);
                if (settings.skip_invisible && !$this.is(":visible")) {
                    return;
                }
                if ($.abovethetop(this, settings) ||
                    $.leftofbegin(this, settings)) {
                        /* Nothing. */
                } else if (!$.belowthefold(this, settings) &&
                    !$.rightoffold(this, settings)) {
                        $this.trigger("appear");
                        /* if we found an image we'll load, reset the counter */
                        counter = 0;
                } else {
                    if (++counter > settings.failure_limit) {
                        return false;
                    }
                }
            });

        }

        if(options) {
            /* Maintain BC for a couple of versions. */
            if (undefined !== options.failurelimit) {
                options.failure_limit = options.failurelimit;
                delete options.failurelimit;
            }
            if (undefined !== options.effectspeed) {
                options.effect_speed = options.effectspeed;
                delete options.effectspeed;
            }

            $.extend(settings, options);
        }

        /* Cache container as jQuery as object. */
        $container = (settings.container === undefined ||
                      settings.container === window) ? $window : $(settings.container);

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        if (0 === settings.event.indexOf("scroll")) {
            $container.on(settings.event, function() {
                return update();
            });
        }

        this.each(function() {
            var self = this;
            var $self = $(self);

            self.loaded = false;

            /* If no src attribute given use data:uri. */
            if ($self.attr("src") === undefined || $self.attr("src") === false) {
                if ($self.is("img")) {
                    $self.attr("src", settings.placeholder);
                }
            }

            /* When appear is triggered load original image. */
            $self.one("appear", function() {
                if (!this.loaded) {
                    if (settings.appear) {
                        var elements_left = elements.length;
                        settings.appear.call(self, elements_left, settings);
                    }
                    $("<img />")
                        .one("load", function() {
                            var original = $self.attr("data-" + settings.data_attribute);
                            $self.hide();
                            if ($self.is("img")) {
                                $self.attr("src", original);
                            } else {
                                $self.css("background-image", "url('" + original + "')");
                            }
                            $self[settings.effect](settings.effect_speed);

                            self.loaded = true;

                            /* Remove image from array so it is not looped next time. */
                            var temp = $.grep(elements, function(element) {
                                return !element.loaded;
                            });
                            elements = $(temp);

                            if (settings.load) {
                                var elements_left = elements.length;
                                settings.load.call(self, elements_left, settings);
                            }
                        })
                        .attr("src", $self.attr("data-" + settings.data_attribute));
                }
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if (0 !== settings.event.indexOf("scroll")) {
                $self.on(settings.event, function() {
                    if (!self.loaded) {
                        $self.trigger("appear");
                    }
                });
            }
        });

        /* Check if something appears when window is resized. */
        $window.on("resize", function() {
            update();
        });

        /* With IOS5 force loading images when navigating with back button. */
        /* Non optimal workaround. */
        if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) {
            $window.on("pageshow", function(event) {
                if (event.originalEvent && event.originalEvent.persisted) {
                    elements.each(function() {
                        $(this).trigger("appear");
                    });
                }
            });
        }

        /* Force initial check if images should appear. */
        $(document).ready(function() {
            update();
        });

        return this;
    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop();
        } else {
            fold = $(settings.container).offset().top + $(settings.container).height();
        }

        return fold <= $(element).offset().top - settings.threshold;
    };

    $.rightoffold = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.width() + $window.scrollLeft();
        } else {
            fold = $(settings.container).offset().left + $(settings.container).width();
        }

        return fold <= $(element).offset().left - settings.threshold;
    };

    $.abovethetop = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollTop();
        } else {
            fold = $(settings.container).offset().top;
        }

        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };

    $.leftofbegin = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollLeft();
        } else {
            fold = $(settings.container).offset().left;
        }

        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };

    $.inviewport = function(element, settings) {
         return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) &&
                !$.belowthefold(element, settings) && !$.abovethetop(element, settings);
     };

    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() or */
    /* $("img").filter(":below-the-fold").something() which is faster */

    $.extend($.expr[":"], {
        "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); },
        "above-the-top"  : function(a) { return !$.belowthefold(a, {threshold : 0}); },
        "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); },
        "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); },
        "in-viewport"    : function(a) { return $.inviewport(a, {threshold : 0}); },
        /* Maintain BC for couple of versions. */
        "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
        "right-of-fold"  : function(a) { return $.rightoffold(a, {threshold : 0}); },
        "left-of-fold"   : function(a) { return !$.rightoffold(a, {threshold : 0}); }
    });

})(jQuery, window, document);

///<jscompress sourcefile="jquery.lottery.js" />
/**
 * @filename jquery.lottery.js
 * @author Aniu[2014-12-02 15:27]
 * @update Aniu[2014-08-26 14:10]
 * @version v2.2
 * @description 抽奖
 */

;!(function(window, document, $, undefined){ 
    $.fn.lottery = function(o){
        o = $.extend({
            speed:240, //初始速度
            trans:2,   //最大速度过渡圈数
            turns:2,   //达到最大速度时圈数
            count:8,   //宫格数量
            rotate:false, //是否旋转
            /**
             * @func 前端不通过ajax交互返回随机数
             * @return <Number>
             * @param self <jQuery Object> 调用组件的当前对象
             */
            getRandom:function(){
                return Math.floor(Math.random()*this.count);
            },
            /**
             * @func 抽奖结束执行函数
             * @param data <Native Object> 数据对象
             * @param items <jQuery Object> 宫格列表jQuery对象
             */
            complete:$.noop,
            /**
             * @func ajax url
             * @type <String, Function>
             * @return <String>
             * @param self <jQuery Object> 调用组件的当前对象
             */
            url:'',
            /**
             * @func ajax传递参数
             * @type <Function>
             * @return <Object>
             */
            getParam:$.noop,
            /**
             * @func ajax交互成功时回调函数
             * @return <Number>
             * @param data <Native Object> 数据对象
             * @param items <jQuery Object> 宫格列表jQuery对象
             */
            succCallback:$.noop,
            /**
             * @func ajax交互失败回调函数
             * @param data <Native Object, Undefined> 数据对象或不传参
             */
            errCallback:$.noop,
            /**
             * @func 改变元素选中状态
             * @param items <jQuery Object> 目标对象
             * @param index <Number> 当前选中索引
             */
            statusCallback:function(items, index){
                items.eq(index).addClass('s-crt').siblings().removeClass('s-crt');
            },
            /**
             * @func 按钮点击时触发函数
             */
            bindClick:$.noop
        }, o||{});

        return this.each(function(){
            var _this = this, self = $(this).css({position:'relative'}), 
                lottery = self.children('.ui-lottery').css({position:'relative'}),
                size = lottery.children('li').size(),
                data = lottery.data();
            o = $.extend(o, data);
            if(o.count > size){
                var len = o.count-size, html = '';
                for(var i=0; i<len; i++){
                    html += '<li></li>';
                }
                lottery.append(html);
            }
            else if(o.count < size){
                o.count = size;
            }
            
            var items = lottery.children('li');
            if(o.rotate !== true){
                var width = self.width(), //容器宽度
                    itemsWidth = items.innerWidth(), //宫格宽度
                    itemsHeight = items.innerHeight(), //宫格高度
                    lineNum = Math.floor(width/itemsWidth), //水平显示数量
                    verNum = Math.floor((o.count-lineNum*2)/2), //垂直显示数量，不包括水平相交的
                    loweRright = lineNum + verNum; //右下角宫格索引
            }
            var button = self.find('.ui-lottery-btn'), //点击按钮
                timer = null, //定时器
                endIndex = 0, //结束索引
                index = 0, //起始索引
                speed = o.speed, //变化速度
                step = o.speed / (o.turns * o.count), //步长
                isAdd = true, //速度是否增大
                data = {}, //complete时传递数据参数
                trans = 0, //过渡圈数
                circle = function(){
                    o.statusCallback(items, index);
                    if(speed > step*2 && isAdd){
                        speed -= step;
                    }
                    else{
                        isAdd = false;
                        if(trans < o.count*o.trans){
                            trans += 1;
                        }
                        else if(speed < o.speed-step){
                            speed += step;
                        }
                        else{
                            if(index == endIndex){
                                data.index = index;
                                isAdd = true;
                                trans = 0;
                                button.removeClass('s-dis');
                                speed = o.speed;
                                o.complete(data, items);
                                clearTimeout(timer);
                                return;
                            }
                        }
                    }
                    index = ++index%o.count;
                    timer = setTimeout(circle, speed);
                }
                
            if(o.rotate !== true){
                items.each(function(){
                    var that = $(this), index = that.index();
                    if(index < lineNum){
                        that.css({top:0, left:(left = that.prevAll().size()*itemsWidth)}); 
                    }
                    else if(index <= loweRright){
                        that.css({top:that.prev().position().top + itemsHeight, left:that.prevAll().position().left});
                    }
                    else if(index > loweRright && index <= (loweRright+lineNum-1)){
                        that.css({top:that.prev().position().top, left:that.prev().position().left-itemsWidth});
                    }
                    else{
                        that.css({top:that.prev().position().top - itemsHeight, left:0});
                    }
                });
            }

            button.click(function(){
                if(!button.hasClass('s-dis')){
                    button.addClass('s-dis');
                    if(o.bindClick() === false){
                        return false;
                    }
                    if(o.url){
                        $.ajax({
                            url:typeof o.url === 'function' ? o.url(self) : o.url,
                            cache:false,
                            dataType:'json',
                            data:o.getParam()||{},
                            success:function(res){
                                if(res.status == 'success'){
                                    if(!isNaN(endIndex = o.succCallback(res, items))){
                                        data = res;
                                        circle();
                                    }
                                }
                                else{
                                    o.errCallback(res);
                                    button.removeClass('s-dis');
                                }
                            },
                            error:function(){
                                o.errCallback();
                                button.removeClass('s-dis');
                            }
                        });
                    }
                    else{
                        if(!isNaN(endIndex = o.getRandom(self))){
                            circle();
                        }
                    }
                }
            });
            
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.paging.js" />
/**
 * @filename jquery.paging.js
 * @author Aniu[2014-03-29 10:07]
 * @update Aniu[2016-03-15 15:13]
 * @version v2.7
 * @description 分页组件
 */

;!(function(window, document, $, undefined){

    function Paging(options){
        var that = this;
        that.load = false;
        //获取实例对象的名称
        that.instance = function(){
            for(var attr in window){
                if(window[attr] == that){
                    return attr.toString();
                }
            }
        }
        $.extend(that, $.extend(true, {
            /**
             * @function ajax请求url
             * @type <String>
             */
            url:'',
            /**
             * @function 数据填充容器
             * @type <Object>
             */
            wrap:null,
            /**
             * @function 传递参数值
             * @type <String>
             * @desc 将传递参数封装为json字符串，后台接收该参数来获取该json
             */
            paramJSON:'',
            /**
             * @function 当页显示数量
             * @type <Number>
             */
            pCount:10,
            /**
             * @function 当前页码
             * @type <Number>
             */
            current:1,
            /**
             * @function 列表数据总数
             * @type <Number>
             */
            aCount:0,
            /**
             * @function 是否初始化展示最后一页
             * @type <Boolean>
             */
            last:false,
            /**
             * @function 是否读取全部数据
             * @type <Boolean>
             * @desc 该参数启用后，接口将无法接收到pCount和current参数，前后端约定好，若没接收到这2个参数，将返回全部数据
             */
            allData:false,
            /**
             * @function 是否完整形式展示分页
             * @type <Boolean>
             */
            isFull:true,
            /**
             * @function ajax配置信息
             * @type <JSON Obejct, Function>
             */
            ajax:{},
            /**
             * @function 接口接收参数
             * @type <JSON Obejct>
             */
            condition:{},
            /**
             * @function loading加载效果
             * @type <JSON Obejct>
             */
            loading:{
                //loading容器
                wrap:null,
                //显示loading
                show:function(){
                    var that = this;
                    that.hide();
                    var wrap = that.wrap;
                    wrap && wrap.append('<i class="ui-loading" style="position:absolute;">正在加载数据...</i>').css({position:'relative'});
                },
                //隐藏loading
                hide:function(){
                    $('.ui-loading').remove();
                }
            },
            /**
             * @function 上一页下一页按钮文字
             * @type <JSON Obejct>
             */
            button:{
                prev:'«',
                next:'»',
                first:'',
                last:''
            },
            /**
             * @function 拓展分页部分
             * @type <JSON Obejct>
             */
            extPage:{
                wrap:null,
                desc:'',
                prev:'上一页',
                next:'下一页'
            },
            /**
             * @function 传统页面刷新方式
             * @type <Null, Function>
             * @param current <Number> 目标页码
             * @desc 值为函数将启用
             */
            refreshCallback:null,
            /**
             * @function ajax响应数据并且分页创建完毕后回调函数
             * @type <Function>
             * @param data <JSON Object> 响应数据
             */
            endCallback:$.noop,
            /**
             * @function 点击分页按钮回调函数
             * @type <Function>
             * @param current <Number> 目标页码
             */
            jumpCallback:$.noop,
            /**
             * @function 分页数据处理
             * @type <Function>
             * @param data <JSON Object> 响应数据
             */
            echoData:$.noop
        }, options||{}));
    }

    Paging.prototype = {
        constructor:Paging,
        //页面跳转
        jump:function(page){
            var that = this, count = Math.ceil(that.aCount/that.pCount), current;
            that.showload = true;
            if(that.aCount > 0){
                if(typeof(page) === 'object'){
                    var val = $(page).prevAll('input').val();
                    if(val <= count && val != that.current){
                        current = parseInt(val);
                    }
                    else{
                        current = that.current;
                    }
                }
                else if(page > 0 && page <= count){
                    current = page;
                }
                else if(page < 0){
                    current = count + page + 1;
                }
                else{
                    current = count;
                }
            }
            else{
                current = page;
            }
            that.current = that.condition.current = current;
            that.jumpCallback(current);
            if(typeof that.refreshCallback === 'function'){
                that.refreshCallback(current);
                that.create();
                return;
            }
            that.getData();
        },
        query:function(type){
            var that = this;
            that.showload = true;
            if(typeof that.refreshCallback !== 'function' || type !== 'refresh'){
                if(type){
                    if(type === 'noloading'){
                        that.showload = false;
                    }
                    else if(type !== 'reload'){
                        that.current = 1;
                    }
                    that.filter();
                    that.condition.current = that.current;
                }
                else{
                    that.condition = {current:that.current = 1};
                }
                that.getData(type||'');
            }
            else{
                that.create();
            }
            
        },
        filter:function(){
            var that = this;
            for(var i in that.condition){
                if(!that.condition[i]){
                    delete that.condition[i];
                }
            }
        },
        //ajax请求数据
        getData:function(type){
            var that = this;
            that.showload && that.loading.show(type);
            that.condition.pCount = that.pCount;
            if(that.allData === true){
                delete that.condition.pCount;
                delete that.condition.current;
            }
            var param = that.condition;
            if(that.paramJSON){
                param = [];
                $.each(that.condition, function(key, val){
                    param.push(key+':'+val);
                });
                var temp = param.length ? '{'+param.join(',')+'}' : '';
                param = {};
                param[that.paramJSON] = temp;
            }
            
            var ajax = typeof that.ajax === 'function' ? that.ajax() : that.ajax;
            delete ajax.success;

            if(!that.load){
            	that.load = true;
            	$.ajax($.extend(true, {
                    url:that.url,
                    cache:false,
                    dataType:'json',
                    data:param,
                    success:function(data){
                        that.showload && that.loading.hide();
                        try{
                            data.current = that.current;
                        }
                        catch(e){}
                        that.echoData(data, type);
                        that.aCount = data.aCount;
                        that.load = false;
                        
                        if(that.last === true){
                            that.last = false;
                            that.jump(-1);
                            return;
                        }
                        that.create();
                        that.endCallback(data);
                    },
                    error:function(){
                        that.showload && that.loading.hide();
                        that.load = false;
                    }
                }, ajax||{}));
            }
        },
        //过滤分页中input值
        trim:function(o){
            var val = Math.abs(parseInt($(o).val()));
            !val && (val = 1);
            $(o).val(val);
        },
        echoList:function(html, i, instance){
            var that = this;
            if(that.current == i){
                html = '<li><span class="s-crt">'+ i +'</span></li>';
            }
            else{
                html = '<li><a href="javascript:'+ instance +'.jump('+ i +');" target="_self">'+ i +'</a></li>';
            }
            return html;
        },
        //创建分页骨架
        create:function(){
            var that = this, button = that.button,
                count = Math.ceil(that.aCount/that.pCount), current = that.current,
                html = '', next = count == current ? 1 : current+1,
                instance = that.instance(), extPage = that.extPage;

            if(extPage.wrap){
                var page = '<div>';
                page += current == count || count == 0 ?
                     '<span>'+ extPage.next +'</span>' : '<a href="javascript:'+ instance +'.jump('+ (current+1) +');" target="_self">'+ extPage.next +'</a>';
                page += current == 1 ?
                     '<span>'+ extPage.prev +'</span>' : '<a href="javascript:'+ instance +'.jump('+ (current-1) +');" target="_self">'+ extPage.prev +'</a>';
                page += '</div><em>'+ (count !== 0 ? current : 0) +'/'+ count +'</em><strong>共'+ that.aCount + extPage.desc +'</strong>';
                extPage.wrap.html(page);
            }
            
            if(!that.wrap){
                return;
            }
            
            if(!count){
                that.wrap.empty();
                return;
            }

            html += (function(){
                var tpl = '';
                if(current == 1){
                    if(button.first){
                        tpl += '<li><span>'+ button.first +'</span></li>';
                    }
                    tpl += '<li><span>'+ button.prev +'</span></li>';
                }
                else{
                    if(that.button.first){
                        tpl += '<li><a href="javascript:'+ instance +'.jump(1);" target="_self">'+ button.first +'</a></li>';
                    }
                    tpl += '<li><a href="javascript:'+ instance +'.jump('+ (current-1) +');" target="_self">'+ button.prev +'</a></li>';
                }
                return tpl;
            })();
            if(count <= 7){
                for(var i = 1; i <= count; i++){
                    html += that.echoList(html, i, instance);
                }
            }
            else{
                if(current-3 > 1 && current+3 < count){
                    html += '<li><a href="javascript:'+ instance +'.jump(1);" target="_self">1</a></li>';
                    html += '<li><em>...</em></li>';
                    for(var i = current-2; i <= current+2; i++){
                        html += that.echoList(html, i, instance);
                    }
                    html += '<li><em>...</em></li>';
                    html += '<li><a href="javascript:'+ instance +'.jump('+ count +');" target="_self">'+ count +'</a></li>';
                }
                else if(current-3 <= 1 && current+3 < count){
                    for(var i = 1; i <= 5; i++){
                        html += that.echoList(html, i, instance);
                    }
                    html += '<li><em>...</em></li>';
                    html += '<li><a href="javascript:'+ instance +'.jump('+ count +');" target="_self">'+ count +'</a></li>';
                }
                else if(current-3 > 1 && current+3 >= count){
                    html += '<li><a href="javascript:'+ instance +'.jump(1);" target="_self">1</a></li>';
                    html += '<li><em>...</em></li>';
                    for(var i = count-5; i <= count; i++){
                        html += that.echoList(html, i, instance);
                    }
                }
            }
            html += (function(){
                var tpl = '';
                if(current == count){
                    tpl += '<li><span>'+ button.next +'</span></li>';
                    if(button.last){
                        tpl += '<li><span>'+ button.last +'</span></li>';
                    }
                }
                else{
                    tpl += '<li><a href="javascript:'+ instance +'.jump('+ (current+1) +');" target="_self">'+ button.next +'</a></li>';
                    if(button.last){
                        tpl += '<li><a href="javascript:'+ instance +'.jump('+ count +');" target="_self">'+ button.last +'</a></li>';
                    }
                }
                return tpl;
            })();
            if(that.isFull){
                html += '<li><em>跳转到第</em><input type="text" onblur="'+ instance +'.trim(this);" value="'+ next +'" /><em>页</em><button type="button" onclick="'+ instance +'.jump(this);">确定</button></li>';
            }
            html = '<ul class="ui-paging">' + html + '</ul>';
            that.wrap.html(html);
        }
    }
    
    $.extend({
        paging:function(name, options){
            if(options === undefined){
                options = name;
                name = 'paging';
            }
            window[name] = new Paging(options);
            if(typeof window[name].refreshCallback !== 'function'){
                window[name].query(true);
                return;
            }
            window[name].query('refresh');
        }
    });
    
    window.Paging = Paging;
    
})(this, document, jQuery);
///<jscompress sourcefile="jquery.parabola.js" />
/**
 * @filename jquery.parabola.js
 * @author Aniu[2014-07-16 11:22]
 * @update Aniu[2016-04-12 10:03]
 * @version v1.2
 * @description none
 */
 
;!(function(window, document, $, undefined){
    $.fn.parabola = function(o){
        o = $.extend({
            speed:300,
            curvature:0.001,
            target:{
                left:0,
                top:0
            },
            moveElement:$.noop,
            complete:$.noop,
            callback:$.noop
        }, o||{});
        return this.each(function(){
            var that = $(this), speed = o.speed, a = o.curvature, b = c = 0, timer = null;
            that.on('click', function(){
            	if(!that.hasClass('s-crt')){
            		that.addClass('s-crt');
					if(o.callback() === false){
						return;
					}
	                var origin = {
	                    x:that.offset().left,
	                    y:that.offset().top
	                }
	                var target = {
	                    x:o.target.left - origin.x,
	                    y:o.target.top - origin.y
	                }
	                //初始位置(0, 0)
	                var x = y = 0, 
	                    //正向or反向
	                    dir = target.x > 0 ? 1: -1, 
	                    s, move, 
	                    ele = o.moveElement(that).css({left:origin.x, top:origin.y});
	                
	                /*
	                 * y1 = ax1*x1 + bx1 + c
	                 * y2 = ax2*x2 + bx2 + c   
	                 * 已知a,c,x1,x2,y1,y2求解b
	                 */
	                b = target.y/target.x - a*target.x;
	                move = function(){
	                    //切线斜率
	                    s = 2*a*x + b;
	                    /* s = y/x
	                     * y = x*s
	                     * x*x + y*y = speed
	                     * x*x + (x*t)^2 = speed
	                     * x = Math.sqrt(speed / (s*s + 1));
	                     */
	                    x += dir * Math.sqrt(speed / (s * s + 1));
	                    if((dir == 1 && x > target.x) || (dir == -1 && x < target.x)){
	                        x = target.x;
	                    }
	                    y = a * Math.pow(x, 2) + b * x;
	                    ele.css({left:origin.x+x, top:origin.y+y});
	                    if(x !== target.x){
	                        timer = setTimeout(function(){
	                            move();
	                        }, 15);
	                    }
	                    else{
	                        clearTimeout(timer);
	                        ele.hide();
	                        o.complete(that, ele);
	                        that.removeClass('s-crt');
	                    }
	                }
	                move();
            	}
            });
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.placeholder.js" />
/**
 * @filename jquery.placeholder.js
 * @author Aniu[2014-3-16 19:40]
 * @update Aniu[2016-04-13 10:10]
 * @version v1.4
 * @description 模拟html5的placeholder效果
 */

;!(function(window, document, $, undefined){
    $.fn.placeholder = function(o){
        o = $.extend({
            /**
             * @func 是否启用动画显示展示
             * @type <Boolean>
             */
            animate:true,
            /**
             * @func 是否使用原生placeholder
             * @type <Boolean>
             */
            proto:true,
            /**
             * @func 输入框值是否可以和占位符相同
             * @type <Boolean>
             */
            equal:false,
            /**
             * @func 占位符文本颜色
             * @type <String>
             */
            color:'#ccc',
            /**
             * @func 类选择器值，可对占位符设置样式
             * @type <String>
             */
            theme:''
        }, o||{});
        return this.each(function(){
            var that = $(this), ph = $.trim(that.attr('placeholder'));
            if(!!ph){
                if(!o.animate && o.proto === true && (supportPlaceholder('input') || supportPlaceholder('textarea'))){
                    return;
                }
                that.removeAttr('placeholder');
                
                if(!$.trim(that.val())){
                    that.val('');
                }
                
                var data = {
                    pleft:parseInt(that.css('paddingLeft')),
                    ptop:parseInt(that.css('paddingTop')),
                    height:that.outerHeight()
                };
                
                var txt = $('<b>'+ ph +'</b>').appendTo(that.wrap('<strong />').parent().css({
                    position:'relative',
                    display:'inline-block',
                    width:that.outerWidth(),
                    overflow:'hidden',
                    cursor:'text'
                }).addClass(o.theme)).css($.extend({
                    position:'absolute',
                    left:data.pleft+1,
                    top:data.ptop,
                    height:data.height,
                    lineHeight:data.height+'px',
                    color:o.color
                }, that.is('textarea') ? {lineHeight:'normal', height:'auto'} : {})).on('click', function(){
                    that.focus();
                });
                
                that.on('focus', function(){
                    o.animate === true && txt.stop(false, true).animate({left:data.pleft+10, opacity:'0.5'});
                }).on('blur change', function(){
                    var val = $.trim(that.val());
                    if((o.equal === false && val == ph) || !val){
                        that.val('');
                        txt.show();
                        o.animate === true && txt.animate({left:data.pleft+1, opacity:'1'});
                    }
                    else{
                        txt.hide();
                    }
                }).on('keyup keydown', function(){
                    $.trim(that.val()) ? txt.hide() : txt.show();
                }).blur();
            }
        });
    }
    
    function supportPlaceholder(element){
        return 'placeholder' in document.createElement(element);  
    }
    
})(this, document, jQuery);
///<jscompress sourcefile="jquery.plax.js" />

(function ($) {

  var maxfps             = 25,
      delay              = 1 / maxfps * 1000,
      lastRender         = new Date().getTime(),
      layers             = [],
      plaxActivityTarget = $(window),
      motionDegrees      = 30,
      motionMax          = 1,
      motionMin          = -1,
      motionStartX       = null,
      motionStartY       = null,
      ignoreMoveable     = false,
      options            = null;

  var defaults = {
    useTransform : true
  };

  // Public Methods
  $.fn.plaxify = function (params){
    options = $.extend({}, defaults, params);
    options.useTransform = (options.useTransform ? supports3dTransform() : false);

    return this.each(function () {

      var layerExistsAt = -1;
      var layer         = {
        "xRange": $(this).data('xrange') || 0,
        "yRange": $(this).data('yrange') || 0,
        "zRange": $(this).data('zrange') || 0,
        "invert": $(this).data('invert') || false,
        "background": $(this).data('background') || false
      };

      for (var i=0;i<layers.length;i++){
        if (this === layers[i].obj.get(0)){
          layerExistsAt = i;
        }
      }

      for (var param in params) {
        if (layer[param] == 0) {
          layer[param] = params[param];
        }
      }

      layer.inversionFactor = (layer.invert ? -1 : 1); // inversion factor for calculations

      // Add an object to the list of things to parallax
      layer.obj    = $(this);
      if(layer.background) {
        // animate using the element's background
        pos = (layer.obj.css('background-position') || "0px 0px").split(/ /);
        if(pos.length != 2) {
          return;
        }
        x = pos[0].match(/^((-?\d+)\s*px|0+\s*%|left)$/);
        y = pos[1].match(/^((-?\d+)\s*px|0+\s*%|top)$/);
        if(!x || !y) {
          // no can-doesville, babydoll, we need pixels or top/left as initial values (it mightbe possible to construct a temporary image from the background-image property and get the dimensions and run some numbers, but that'll almost definitely be slow)
          return;
        }
        layer.originX = layer.startX = x[2] || 0;
        layer.originY = layer.startY = y[2] || 0;
        layer.transformOriginX = layer.transformStartX = 0;
        layer.transformOriginY = layer.transformStartY = 0;
        layer.transformOriginZ = layer.transformStartZ = 0;

      } else {

        // Figure out where the element is positioned, then reposition it from the top/left, same for transform if using translate3d
        var position           = layer.obj.position(),
            transformTranslate = get3dTranslation(layer.obj);

        layer.obj.css({
          'transform' : transformTranslate.join() + 'px',
          'top'   : position.top,
          'left'  : position.left,
          'right' :'',
          'bottom':''
        });
        layer.originX = layer.startX = position.left;
        layer.originY = layer.startY = position.top;
        layer.transformOriginX = layer.transformStartX = transformTranslate[0];
        layer.transformOriginY = layer.transformStartY = transformTranslate[1];
        layer.transformOriginZ = layer.transformStartZ = transformTranslate[2];
      }

      layer.startX -= layer.inversionFactor * Math.floor(layer.xRange/2);
      layer.startY -= layer.inversionFactor * Math.floor(layer.yRange/2);

      layer.transformStartX -= layer.inversionFactor * Math.floor(layer.xRange/2);
      layer.transformStartY -= layer.inversionFactor * Math.floor(layer.yRange/2);
      layer.transformStartZ -= layer.inversionFactor * Math.floor(layer.zRange/2);

      if(layerExistsAt >= 0){
        layers.splice(layerExistsAt,1,layer);
      } else {
        layers.push(layer);
      }

    });
  };

  // Get the translate position of the element
  //
  // return 3 element array for translate3d
  function get3dTranslation(obj) {
    var translate = [0,0,0],
        matrix    = obj.css("-webkit-transform") ||
                    obj.css("-moz-transform")    ||
                    obj.css("-ms-transform")     ||
                    obj.css("-o-transform")      ||
                    obj.css("transform");

    if(matrix !== 'none') {
      var values = matrix.split('(')[1].split(')')[0].split(',');
      var x = 0,
          y = 0,
          z = 0;
      if(values.length == 16){
        // 3d matrix
        x = (parseFloat(values[values.length - 4]));
        y = (parseFloat(values[values.length - 3]));
        z = (parseFloat(values[values.length - 2]));
      }else{
        // z is not transformed as is not a 3d matrix
        x = (parseFloat(values[values.length - 2]));
        y = (parseFloat(values[values.length - 1]));
        z = 0;
      }
      translate = [x,y,z];
    }
    return translate;
  }

  // Check if element is in viewport area
  //
  // Returns boolean
  function inViewport(element) {
    if (element.offsetWidth === 0 || element.offsetHeight === 0) return false;

	var height = document.documentElement.clientHeight,
      rects  = element.getClientRects();

	for (var i = 0, l = rects.length; i < l; i++) {

    var r           = rects[i],
        in_viewport = r.top > 0 ? r.top <= height : (r.bottom > 0 && r.bottom <= height);

    if (in_viewport) return true;
	}
	return false;
  }

  // Check support for 3dTransform
  //
  // Returns boolean
  function supports3dTransform() {
    var el = document.createElement('p'),
        has3d,
        transforms = {
          'webkitTransform':'-webkit-transform',
          'OTransform':'-o-transform',
          'msTransform':'-ms-transform',
          'MozTransform':'-moz-transform',
          'transform':'transform'
        };

    document.body.insertBefore(el, null);

    for (var t in transforms) {
      if (el.style[t] !== undefined) {
        el.style[t] = "translate3d(1px,1px,1px)";
        has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
      }
    }

    document.body.removeChild(el);
    return (has3d !== undefined && has3d.length > 0 && has3d !== "none");
  }

  // Determine if the device has an accelerometer
  //
  // returns true if the browser has window.DeviceMotionEvent (mobile)
  function moveable(){
    return (ignoreMoveable===true) ? false : window.DeviceOrientationEvent !== undefined;
  }

  // The values pulled from the gyroscope of a motion device.
  //
  // Returns an object literal with x and y as options.
  function valuesFromMotion(e) {
    x = e.gamma;
    y = e.beta;

    // Swap x and y in Landscape orientation
    if (Math.abs(window.orientation) === 90) {
      var a = x;
      x = y;
      y = a;
    }

    // Invert x and y in upsidedown orientations
    if (window.orientation < 0) {
      x = -x;
      y = -y;
    }

    motionStartX = (motionStartX === null) ? x : motionStartX;
    motionStartY = (motionStartY === null) ? y : motionStartY;

    return {
      x: x - motionStartX,
      y: y - motionStartY
    };
  }

  // Move the elements in the `layers` array within their ranges,
  // based on mouse or motion input
  //
  // Parameters
  //
  //  e - mousemove or devicemotion event
  //
  // returns nothing
  function plaxifier(e) {
    if (new Date().getTime() < lastRender + delay) return;
      lastRender = new Date().getTime();

    var leftOffset = (plaxActivityTarget.offset() != null) ? plaxActivityTarget.offset().left : 0,
        topOffset  = (plaxActivityTarget.offset() != null) ? plaxActivityTarget.offset().top : 0,
        x          = e.pageX-leftOffset,
        y          = e.pageY-topOffset;

    if (!inViewport(layers[0].obj[0].parentNode)) return;

    if(moveable()){
      if(e.gamma === undefined){
        ignoreMoveable = true;
        return;
      }
      values = valuesFromMotion(e);

      // Admittedly fuzzy measurements
      x = values.x / motionDegrees;
      y = values.y / motionDegrees;
      // Ensure not outside of expected range, -1 to 1
      x = x < motionMin ? motionMin : (x > motionMax ? motionMax : x);
      y = y < motionMin ? motionMin : (y > motionMax ? motionMax : y);
      // Normalize from -1 to 1 => 0 to 1
      x = (x + 1) / 2;
      y = (y + 1) / 2;
    }

    var hRatio = x/((moveable() === true) ? motionMax : plaxActivityTarget.width()),
        vRatio = y/((moveable() === true) ? motionMax : plaxActivityTarget.height()),
        layer, i;

    for (i = layers.length; i--;) {
      layer = layers[i];
      if(options.useTransform && !layer.background){
        newX = layer.transformStartX + layer.inversionFactor*(layer.xRange*hRatio);
        newY = layer.transformStartY + layer.inversionFactor*(layer.yRange*vRatio);
        newZ = layer.transformStartZ;
        layer.obj
            .css({'transform':'translate3d('+newX+'px,'+newY+'px,'+newZ+'px)'});
      }else{
        newX = layer.startX + layer.inversionFactor*(layer.xRange*hRatio);
        newY = layer.startY + layer.inversionFactor*(layer.yRange*vRatio);
        if(layer.background) {
          layer.obj
            .css('background-position', newX+'px '+newY+'px');
        } else {
          layer.obj
            .css('left', newX)
            .css('top', newY);
        }
      }
    }
  }

  $.plax = {
    // Begin parallaxing
    //
    // Parameters
    //
    //  opts - options for plax
    //    activityTarget - optional; plax will only work within the bounds of this element, if supplied.
    //
    //  Examples
    //
    //    $.plax.enable({ "activityTarget": $('#myPlaxDiv')})
    //    # plax only happens when the mouse is over #myPlaxDiv
    //
    // returns nothing
    enable: function(opts){
      if (opts) {
        if (opts.activityTarget) plaxActivityTarget = opts.activityTarget || $(window);
        if (typeof opts.gyroRange === 'number' && opts.gyroRange > 0) motionDegrees = opts.gyroRange;
      }

      plaxActivityTarget.bind('mousemove.plax', function (e) {
        plaxifier(e);
      });

      if(moveable()){
        window.ondeviceorientation = function(e){plaxifier(e);};
      }

    },

    // Stop parallaxing
    //
    //  Examples
    //
    //    $.plax.disable()
    //    # plax no longer runs
    //
    //    $.plax.disable({ "clearLayers": true })
    //    # plax no longer runs and all layers are forgotten
    //
    // returns nothing
    disable: function(opts){
      $(document).unbind('mousemove.plax');
      window.ondeviceorientation = undefined;
      if (opts && typeof opts.restorePositions === 'boolean' && opts.restorePositions) {
        for(var i = layers.length; i--;) {
          layer = layers[i];
          if(options.useTransform && !layer.background){
            layer.obj
                .css('transform', 'translate3d('+layer.transformOriginX+'px,'+layer.transformOriginY+'px,'+layer.transformOriginZ+'px)')
                .css('top', layer.originY);
          }else{
            if(layers[i].background) {
              layer.obj.css('background-position', layer.originX+'px '+layer.originY+'px');
            } else {
              layer.obj
                .css('left', layer.originX)
                .css('top', layer.originY);
            }
          }
        }
      }
      if (opts && typeof opts.clearLayers === 'boolean' && opts.clearLayers) layers = [];
    }
  };

  if (typeof ender !== 'undefined') {
    $.ender($.fn, true);
  }

})(function () {
  return typeof jQuery !== 'undefined' ? jQuery : ender;
}());
(function(e){function l(){return f==true?false:window.DeviceOrientationEvent!=undefined}function c(e){x=e.gamma;y=e.beta;if(Math.abs(window.orientation)===90){var t=x;x=y;y=t}if(window.orientation<0){x=-x;y=-y}u=u==null?x:u;a=a==null?y:a;return{x:x-u,y:y-a}}function h(e){if((new Date).getTime()<r+n)return;r=(new Date).getTime();var t=s.offset()!=null?s.offset().left:0,u=s.offset()!=null?s.offset().top:0,a=e.pageX-t,h=e.pageY-u;if(a<0||a>s.width()||h<0||h>s.height())return;if(l()){if(e.gamma==undefined){f=true;return}values=c(e);a=values.x/30;h=values.y/30}var p=a/(l()==true?o:s.width()),d=h/(l()==true?o:s.height()),v,m;for(m=i.length;m--;){v=i[m];newX=v.startX+v.inversionFactor*v.xRange*p;newY=v.startY+v.inversionFactor*v.yRange*d;if(v.background){v.obj.css("background-position",newX+"px "+newY+"px")}else{v.obj.css("left",newX).css("top",newY)}}}var t=25,n=1/t*1e3,r=(new Date).getTime(),i=[],s=e(window),o=1,u=null,a=null,f=false;e.fn.plaxify=function(t){return this.each(function(){var n=-1;var r={xRange:e(this).data("xrange")||0,yRange:e(this).data("yrange")||0,invert:e(this).data("invert")||false,background:e(this).data("background")||false};for(var s=0;s<i.length;s++){if(this===i[s].obj.get(0)){n=s}}for(var o in t){if(r[o]==0){r[o]=t[o]}}r.inversionFactor=r.invert?-1:1;r.obj=e(this);if(r.background){pos=(r.obj.css("background-position")||"0px 0px").split(/ /);if(pos.length!=2){return}x=pos[0].match(/^((-?\d+)\s*px|0+\s*%|left)$/);y=pos[1].match(/^((-?\d+)\s*px|0+\s*%|top)$/);if(!x||!y){return}r.startX=x[2]||0;r.startY=y[2]||0}else{var u=r.obj.position();r.obj.css({top:u.top,left:u.left,right:"",bottom:""});r.startX=this.offsetLeft;r.startY=this.offsetTop}r.startX-=r.inversionFactor*Math.floor(r.xRange/2);r.startY-=r.inversionFactor*Math.floor(r.yRange/2);if(n>=0){i.splice(n,1,r)}else{i.push(r)}})};e.plax={enable:function(t){e(document).bind("mousemove.plax",function(n){if(t){s=t.activityTarget||e(window)}h(n)});if(l()){window.ondeviceorientation=function(e){h(e)}}},disable:function(t){e(document).unbind("mousemove.plax");window.ondeviceorientation=undefined;if(t&&typeof t.clearLayers==="boolean"&&t.clearLayers)i=[]}};if(typeof ender!=="undefined"){e.ender(e.fn,true)}})(function(){return typeof jQuery!=="undefined"?jQuery:ender}())

///<jscompress sourcefile="jquery.print.js" />
/**
 * @filename jquery.print.js
 * @author Aniu[2016-03-15 13:25]
 * @update Aniu[2016-03-21 10:49]
 * @version v1.2
 * @description 打印
 */

;!(function(window, document, $, undefined){
    $.fn.print = function(o){
        o = $.extend(true, {
            /**
             * @func 打印元素
             * @type <Object, String>
             * @desc 为空将打印全部网页内容
             */
            element:'',
            /**
             * @func iframe打印
             * @type <Object>
             */
            iframe:{
                enable:true,
                title:''
            },
            /**
             * @func 分页打印
             * @type <Function>
             * @return <undefined>
             * @param element <Object> 打印内容JQ对象
             * @param css <Object> 打印样式类
             * @desc 通过element筛选需要分页的元素添加css对象
             */
            callback:$.noop
        }, o||{});
        
        var me = $(this);
        var page = {'page-break-after':'always'};
        var body = $('body');
        //防止打印界面的该组件被再次调用
        if(!me.attr('bindprint')){
            me.attr('bindprint', '1');
            var ele = typeof o.element === 'string' ? $(o.element).clone() : o.element.clone();
            me.on('click', function(e){
                if(o.element){
                    if(o.iframe.enable === true){
                        var iframeBox = $('<div><iframe /></div>').appendTo('body');
                        var iframe = iframeBox.children();
                        iframeBox.css({
                            height:0,
                            width:0,
                            margin:0,
                            padding:0,
                            overflow:'hidden',
                            dislay:'block'
                        });
                        var contents = iframe.contents();
                        var iframeHead = contents.find('head');
                        iframe = iframe[0];
                        var iframeWin = iframe.contentWindow;
                        var iframeDoc = iframeWin.document;
                        iframeDoc.write('<title>'+ (o.iframe.title || '&nbsp;') +'</title>');
                        o.callback(ele, page, iframeDoc);
                        $('link[rel="stylesheet"]').each(function(){
                            iframeDoc.write('<link rel="stylesheet" type="text/css" href="'+ $(this).attr('href') +'" />');
                        });
                        $('style').each(function(){
                            iframeDoc.write('<style>'+ $(this).text() +'</style>');
                        });
                        iframeDoc.write(ele.prop('outerHTML'));
                        iframeDoc.close();
                        iframeWin.focus();
                        setTimeout(function(){
                            iframeWin.print();
                            iframeBox.remove();
                        }, 500);
                    }
                    else{
                        body.children().wrapAll('<div class="ui-printbox" style="display:none;"></div>');
                        o.callback(ele, page);
                        body.append(ele);
                        setTimeout(function(){
                            print();
                            ele.remove();
                            $('.ui-printbox').children().unwrap();
                        }, 100);
                    }
                }
                else{
                    o.callback(body, page);
                    print();
                } 
                
                e.stopPropagation();
            });
        }
        return this;
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.select.js" />
/**
 * @filename jquery.select.js
 * @author Aniu[2014-03-24 20:13]
 * @update Aniu[2016-03-18 13:22]
 * @version v2.7
 * @description 下拉框组件
 */
 
;!(function(window, document, $, undefined){
    $.fn.imitSelect = function(o){
        o = $.extend(true, {
            /**
             * @func 下拉显示个数
             * @type <Number>
             */
            count:8,
            /**
             * @func 添加css3动画类
             * @type <String>
             */
            animate:'',
            /**
             * @func 添加自定义结构
             * @type <String>
             */
            selext:'',
            /**
             * @func 设置下拉框默认值
             * @type <String, Number>
             */
            value:null,
            /**
             * @func 是否禁用下拉框
             * @type <Boolean>
             */
            disabled:null,
            /**
             * @func 是否初始化默认值，配合value属性使用
             * @type <Boolean>
             */
            isInit:true,
            /**
             * @func 将value值清空
             * @type <Boolean>
             */
            isNull:false,
            /**
             * @func 下拉框是否可编辑
             * @type <Boolean>
             */
            isEdit:false,
            /**
             * @func 是否隐藏下拉框
             * @type <Boolean>
             */
            hide:false,
            /**
             * @func 下拉框列表是否有title提示
             * @type <Boolean>
             */
            isTitle:false,
            /**
             * @func 下拉框搜索
             * @type <Object>
             */
            search:{
                /**
                 * @func 是否开启
                 * @type <Boolean>
                 */
                enable:false,
                /**
                 * @func 搜索默认占位符文本，配合jqyery.placeholder组件使用
                 * @type <String>
                 */
                tips:'',
                /**
                 * @func 未搜索到结果提示文本
                 * @type <String>
                 */
                text:''
            },
            /**
             * @func 上下点击选择按钮
             * @type <Object>
             */
            button:{
                /**
                 * @func 是否开启
                 * @type <Boolean>
                 */
                enable:false,
                prev:'',
                next:''
            },
            /**
             * @func 点击列表回调函数，初始化时会调用一次
             * @type <Function>
             * @param target <jQuery Obeject> 调用组件的select JQ对象
             */
            callback:null,
            /**
             * @func 过滤文本函数
             * @type <Function>
             * @param text <String> 下拉框选中文本
             */
            filter:null
        }, o||{});
        
        return this.each(function(){
            var _this = this, that = $(this);
            o.disabled !== null && that.prop('disabled', o.disabled);
            o.value !== null && that.data('value', o.value);
            if(o.isNull === true){
                that.data('value', '').val('');
            }
            var value = that.data('value'), 
                func = that.data('func'),
                init = that.data('init'),
                disabled = that.prop('disabled');
            that.prev('.ui-imitselect').remove();
            if(o.hide === true){
                return;
            }
            if(!!func && !disabled && !init){
                eval('var option = '+func+'()');
                if(option === false){
                    return;
                }
                that.html(option);
                option = null;
                value !== undefined && that.next('select').prop('disabled', false);
            }
            if(typeof o.callback == 'function'){
                o.callback(that);
            }
            if(value !== undefined && o.isInit === true){
                that.val(value);
            }
            var index = that[0].selectedIndex,
                size = that.children('option').size(),
                list = html = height = select = '',
                text = '请选择',
                css = 'width:'+(that.outerWidth()+20)+'px; ' + (that.data('css') ? that.data('css') : ''),
                style = 'style="'+ css +'; position:relative;"';
            var button = '';
            if(o.button.enable === true){
                button = '<div class="ui-imitselect-btn"><em class="prev">'+ o.button.prev +'</em><em class="next">'+ o.button.next +'</em></div>';
            }
            if(size > 0 && !that.data('init')){
                that.children('option').each(function(){
                    var me = $(this), crt = '', dis = '';
                    if(me.index() === index){
                        crt = ' class="s-crt';
                        text = me.text();
                    }
                    if(me.prop('disabled')){
                        dis = 'disabled="disabled"';
                        if(crt){
                            crt += ' s-dis'
                        }
                        else{
                            crt = ' class="s-dis';
                        }
                    }
                    crt && (crt += '"');
                    if(!!me.text()){
                        list  = list + '<li'+ crt + ' data-value="'+ me.attr('value') +'" title="'+ (o.isTitle ? me.text() : '') +'">'+ me.text() +'</li>';
                    }
                });
                if(typeof o.filter == 'function'){
                    text = o.filter(text);
                }
                html += '<dl class="ui-imitselect'+ (disabled ? ' s-dis' : '') +'" '+ style +'>';
                html += '<dt><span><strong>'+ text +'</strong></span><b><i></i></b>'+ button + o.selext +'</dt>';
                html += '<dd class="ui-animate">'+ (o.search.enable ? '<div class="ui-imitselect-search"><input type="text" placeholder="'+ o.search.tips +'" /></div>' : '') +'<ul>'+ list +'</ul></dd></dl>';
            }
            else{
                html += '<dl class="ui-imitselect'+ (disabled ? ' s-dis' : '') +'" '+ style +'>';
                html += '<dt><span><strong>'+ text +'</strong></span><b><i></i></b>'+ button + o.selext +'</dt><dd class="ui-animate"><ul></ul></dd></dl>';
            }
            
            if(o.isEdit === true){
                html = html.replace(/<strong>([\s\S]*)<\/strong>/g, '<strong><input type="text" '+ (disabled ? 'disabled' : '') +' name="'+ that.attr('name') +'" id="'+ that.attr('id') +'" value="$1" autocomplete="off" /></strong>');
                that.removeAttr('name').removeAttr('id');
            }
            var select = $(html).insertBefore(that), selectbox = select.find('ul'), itemHeight = selectbox.children('li').outerHeight(), imitselectAll = $('.ui-imitselect'), total = imitselectAll.size();
            size > o.count && selectbox.css({height:itemHeight*o.count, overflowY:'scroll'});
            if(o.search.enable && o.search.tips){
                select.find('.ui-imitselect-search input').placeholder({isVal:false}).parent().css({width:'100%'});
            }
            imitselectAll.each(function(index, item){
                $(this).css('z-index', total - index);
            });
            var imitselect = that.prev('.ui-imitselect:not(.s-dis)');
            imitselect.on('click', function(){
                var select = $(this);
                if(that.data('init')){
                    eval('var option = '+init+'()');
                    that.html(option);
                    option = '';
                    that.data('init', '').children('option').each(function(){
                        var me = $(this), crt = '';
                        if(me.index() === index){
                            crt = ' class="s-crt"';
                            text = me.text();
                        }
                        option += '<li'+ crt + ' data-value='+ me.attr('value') +'>'+ me.text() +'</li>';
                    });
                    var item = selectbox.html(option).children('li'), size = item.size();
                    itemHeight = item.outerHeight();
                    value !== undefined && that.next('select').prop('disabled', false);
                    size > o.count && selectbox.css({height:itemHeight*o.count, overflowY:'scroll'});
                }
                $(this).addClass('s-show').children('dd').removeClass(o.animate).addClass(o.animate);
                return false;
            }).on('click', '.ui-imitselect-btn', function(){
                return false;
            }).on('click', '.ui-imitselect-btn em', function(){
                var index = _this.selectedIndex;
                if($(this).hasClass('prev')){
                    if(index > 0){
                        index--;
                    }
                }
                else{
                    if(index < size-1){
                        index++;
                    }
                }
                
                var target = selectbox.children('li').eq(index);
                if(!target.hasClass('s-nodata')){
                    target.addClass('s-crt');
                    _this.selectedIndex = index;
                    var txt = target.text();
                    if(typeof o.filter == 'function'){
                        txt = o.filter(txt);
                    }
                    if(o.isEdit !== true){
                        select.find('dt strong').text(txt);
                    }
                    else{
                        select.find('dt input').val(txt);
                    }
                    target.siblings().removeClass('s-crt');
                    if(typeof o.callback == 'function'){
                        o.callback(that, target);
                    }
                }
                
                return false;
            }).on('mouseleave', function(){
                $(this).find('dd li[data-value="'+ $(this).next('select').val() +'"]').addClass('s-crt').siblings().removeClass('s-crt');
            }).find('dt input').on('click', function(){
                return false;
            }).end().find('ul').on('click', 'li:not(.s-nodata)', function(){
                var me = $(this);
                if(me.hasClass('s-dis')){
                    if(typeof o.callback == 'function'){
                        o.callback(that, me);
                    }
                    return false;
                }
                var txt = me.text();
                if(typeof o.filter == 'function'){
                    txt = o.filter(txt);
                }
                var parent = me.closest('.ui-imitselect'), select = parent.next('select'), 
                    target = (o.isEdit !== true ? parent.find('dt strong').text(txt) : parent.find('dt input').val(txt)).end();
                select.data('value', select.val(me.data('value')).val());
                target.removeClass('s-show');
                if(func){
                    window[func].ele = parent;
                    eval(func+'("'+ me.data('value') +'")');
                }
                else if(init){
                    window[init].ele = parent;
                    eval(init+'("'+ me.data('value') +'")');
                }
                if(typeof o.callback == 'function'){
                    o.callback(that, me);
                }
                return false;
            }).on('mouseenter', 'li:not(.s-nodata)', function(){
                $(this).addClass('s-crt').siblings().removeClass('s-crt');
            }).end().find('.ui-imitselect-search input').on('keyup', function(){
                var val = $.trim($(this).val()), 
                    cache = $(list), 
                    count = cache.size(),
                    styleTemp = {height:'auto', overflowY:'visible'};
                if(val){
                    var temp = [];
                    cache.each(function(){
                        var me = $(this), value = me.data('value').toString(), text = $.trim(me.text());
                        if(value.indexOf(val) !== -1 || text.indexOf(val) !== -1){
                            temp.push(me[0]);
                        }
                    });
                    if(temp.length){
                        cache = $(temp);
                    }
                    else{
                        cache = $('<li class="s-nodata">'+ o.search.text +'</li>');
                    }
                    count = cache.size();
                }
                if(count > o.count){
                    styleTemp = {height:itemHeight*o.count, overflowY:'scroll'};
                }
                selectbox.html(cache).css(styleTemp);
            });
            
            $(document).on('click', function(){
                imitselect.removeClass('s-show');
            });
            
        }).hide();
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.suggest.js" />
/**
 * @filename jquery.suggest.js
 * @author Aniu[2014-04-07 09:15]
 * @update Aniu[2016-01-19 18:27]
 * @version v1.7
 * @description 搜索提示
 */

;!(function(window, document, $, undefined){
    
    var Suggest = function(target, setting){
        var that = this;
        that.target = target;
        that.eventArray = [];
        that.setting = $.extend(true, {
            /**
             * @func ajax请求url
             * @type <String>
             */
            url:'',
            /**
             * @func 远程接口接收参数
             * @type <String>
             */
            param:'keywords',
            /**
             * @func 自定义组件主题
             * @type <String>
             */
            theme:'',
            /**
             * @func 指定下拉列表文本
             * @type <String>
             * @desc 将列表指定元素内容赋值到输入框中
             */
            getDom:'',
            /**
             * @func 下拉数据展示数量，多出则滚动显示
             * @type <Number>
             */
            limit:10,
            /**
             * @func 是否默认选中第一行列表
             * @type <Boolean>
             */
            select:false,
            /**
             * @func 是否开启缓存
             * @type <Boolean>
             * @desc 将对应关键词查询到的数据保存到js中，下次再搜索该词将不调用接口
             */
            cache:true,
            /**
             * @func 非ajax加载数据
             * @type <Function>
             * @return <Obejct, Array> 列表数据
             * @param keywords <String> 关键字
             * @param target <Object> 目标输入框jQuery对象
             * @desc 若没有设置url参数，将启用该方法
             */
            getData:null,
            /**
             * @func 下拉框定位垂直偏移
             * @type <Number, Function>
             * @return <Number>
             */
            offsetTop:0,
            /**
             * @func 处理列表数据
             * @type <Function>
             * @return <String> 处理后的列表li元素
             * @param item <String, Object, Array> 单行源数据
             */
            returnData:$.noop,
            /**
             * @func 选择列表行触发函数
             * @type <Function>
             * @param item <Object> 触发事件行jQuery对象
             * @param target <Object> 目标输入框jQuery对象
             * @param keyevent <Boolean> 是否上下键盘时间选择下拉
             */
            eventEnd:$.noop,
            /**
             * @func 初始化组件完成回调函数
             * @type <Function>
             * @param target <Object> 目标输入框jQuery对象
             * @param suggestlist <Object> 下拉框jQuery对象
             */
            callback:$.noop,
            /**
             * @func 隐藏下拉框回调函数
             * @type <Function>
             * @param target <Object> 目标输入框jQuery对象
             * @param items <Object> 下拉框列表jQuery对象
             */
            hideEvent:$.noop,
            /**
             * @func 自定义下拉框显示内容
             * @type <Function>
             */
            diyCallback:$.noop
        }, setting||{});
    }, doc = $(document);
    
    Suggest.prototype = {
        constructor:Suggest,
        liSize:0,
        cache:{},
        isbind:true,
        init:function(keywords){
            var that = this, sets = that.setting;
            that.ishide = false;
            that.keywords = keywords;
            that.suggest = $('.ui-suggest');
            if(!that.suggest.size()){
                var diy = sets.diyCallback()||'';
                that.suggest = $('<div class="ui-suggest"><ul class="ui-suggest-list"></ul>'+ diy +'</div>').appendTo('body').addClass(sets.theme);
            }
            that.suggestlist = that.suggest.children('.ui-suggest-list');
            that.request && that.request.abort();
            that.show();
            if(sets.select !== true){
                that.suggestlist.scrollTop(0);
            }
            sets.callback && sets.callback.call(this, that.target, that.suggestlist);
        },
        show:function(){
            var that = this, sets = that.setting;
            if(sets.cache === true){
                var cache = that.cache[that.keywords];
                if(cache){
                    that.filterData(cache);
                    return;
                }
            }
            if(sets.url){
                var param = {};
                param[sets.param] = that.keywords;
                that.request = $.ajax({
                    url:sets.url,
                    dataType:'json',
                    cache:false,
                    data:param,
                    success:function(res){
                        that.filterData(res);
                    }
                });
            }
            else if(typeof sets.getData === 'function'){
                that.filterData(sets.getData(that.keywords, that.target)||null);
            }
        },
        hide:function(){
            var that = this, sets = that.setting;
            that.isbind = true;
            that.unbindEvent();
            sets.hideEvent.call(that, that.target, that.suggestlist.children('li'));
            that.suggest.remove();
        },
        filterData:function(res){
            var that = this, sets = that.setting, target = that.target, style;
            if(res && res[0] !== undefined && !that.ishide){
                if(sets.cache === true){
                    that.cache[that.keywords] = res;
                }
                that.keywords
                var arr = [],num = 0,
                    html = (function(res){
                    $.each(res, function(index, item){
                        arr.push(sets.returnData.call(this, item));
                        num += 1;
                    });
                    that.liSize = num;
                    return arr.join('');
                })(res);
                var top = parseFloat(typeof sets.offsetTop === 'function' ? sets.offsetTop() : sets.offsetTop);
                if(!top){
                    top = 0;
                }
                var style = {
                    top:target.offset().top+target.outerHeight() - 1 + top,
                    left:target.offset().left,
                    width:target.outerWidth()
                }
                that.suggest.css(style).show();
                var item = that.suggestlist.html(html);
                that.itemHeight = item.children('li').outerHeight()||0;
                var _style = that.liSize > sets.limit ? {overflowY:'scroll', height:that.itemHeight*sets.limit} : {overflowY:'visible', height:'auto'};
                item.css(_style);
                if(sets.select === true){
                    var val = $.trim(target.val());
                    var i = 0;
                    item.children('li').each(function(index, item){
                        var me = $(this);
                        var text = $.trim(me.text());
                        if(val == text){
                            i = index;
                            return false;
                        }
                    });
                    item.children('li').eq(i).addClass('s-crt');
                    that.suggestlist.scrollTop(that.itemHeight*i);
                }
                var height = that.suggest.height();
                if($(window).height() - style.top < height){
                    that.suggest.css({top:style.top - height - target.outerHeight() + 1 - top});
                }
                if(that.isbind){
                    that.bindMouse();
                    that.bindKeyboard();
                    that.isbind = false;
                }
            }
            else{
                that.hide();
            }
        },
        bindMouse:function(){
            var that = this, sets = that.setting;
            that.bindEvent(doc, 'click', function(e){
                that.ishide = true;
                that.hide();
            });
            that.suggest.on('mouseover', function(){
                that.suggest.addClass('s-evt');
            });
            that.suggestlist.on('click', 'li', function(){
                var me = $(this);
                sets.getDom ? that.target.val(me.find(sets.getDom).text()) : that.target.val(me.text());
                sets.eventEnd.call(this, me, that.target);
                that.hide();
                return false;
            }).on('mouseover', 'li', function(){
                $(this).addClass('s-crt').siblings().removeClass('s-crt');
            }).on('mouseout', 'li', function(){
                $(this).removeClass('s-crt');
            });
        },
        bindKeyboard:function(){
            var that = this, sets = that.setting, index = -1, current = null;
            that.bindEvent(doc, 'keydown' , function(e){
                if(e.keyCode == 38 || e.keyCode == 40){
                    if(e.keyCode == 38){
                        if(index > 0){
                            index-=1;
                            if((index+1) % sets.limit === 0){
                                that.suggestlist.animate({scrollTop:(index-sets.limit)*that.itemHeight});
                            }
                        }
                        else{
                            index=that.liSize-1;
                            that.suggestlist.animate({scrollTop:that.itemHeight*index});
                        }
                    }
                    else{
                        if(index >= that.liSize-1){
                            index=0;
                            that.suggestlist.animate({scrollTop:0});
                        }
                        else{
                            index+=1;
                            if(index % sets.limit === 0){
                                that.suggestlist.animate({scrollTop:that.itemHeight*index});
                            }
                        }
                    }
                    current = that.suggestlist.children('li:eq('+ index +')');
                    current.addClass('s-crt').siblings().removeClass('s-crt');
                    sets.eventEnd.call(this, current, that.target, true);
                    sets.getDom ? that.target.val(current.find(sets.getDom).text()) : that.target.val(current.text());
                }
                else if(e.keyCode == 13){
                    if(sets.select === true){
                        if($.trim(that.target.val())){
                            that.suggestlist.children('li.s-crt').click();
                            that.hide();
                        }
                    }
                    else{
                        that.hide();
                    }
                }
            });
        },
        bindEvent:function(target, eventType, callback, EventInit){
            var that = this;
            target.bind(eventType, callback);
            EventInit === true && target[eventType]();
            that.eventArray.push({
                target:target,
                eventType:eventType,
                callback:callback
            });
        },
        unbindEvent:function(){
            var that = this, eArr = that.eventArray, i, temp;
            for(i in eArr){
                temp = eArr[i];
                temp.target.unbind(temp.eventType, temp.callback);
            }
            that.eventArray.length = 0;
        }
    }
    
    $.fn.suggest = function(setting){
        return this.each(function(){
            var target = $(this).attr('autocomplete', 'off');
            var sug = new Suggest(target, setting);
            target.on('keyup', function(e){
                switch(e.keyCode){
                    case 38:
                    case 40:
                    case 13:
                        return false;
                        break;
                }
                if(e.ctrlKey && e.keyCode === 83){
                    return false;
                }
                var keywords = $.trim($(this).val());
                if(keywords){
                    sug.init(keywords);
                }
                else{
                    if(setting.keywords !== undefined){
                        sug.init(setting.keywords);
                    }
                    else{
                        if(sug.suggest && sug.suggest.size()){
                            sug.hide();
                        }
                    }
                }   
            }).on('click', function(){
                return false;
            }).on('blur', function(){
                setTimeout(function(){
                    if(sug.suggest && !sug.suggest.hasClass('s-evt')){
                        sug.hide();
                    }
                }, 250);
            });
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.supermarquee.js" />
(function($){

    $.fn.superMarquee = function(options){
        var opts = $.extend({},$.fn.superMarquee.defaults, options);
        
        return this.each(function(){
            var $marquee = $(this);//滚动元素容器
            var _scrollObj = $marquee.get(0);//滚动元素容器DOM
            var scrollW = $marquee.width();//滚动元素容器的宽度
            var scrollH = $marquee.height();//滚动元素容器的高度
            var $element = $marquee.children(); //滚动元素
            var $kids = $element.children();//滚动子元素
            var scrollSize=0;//滚动元素尺寸
            var _type = (opts.direction == 'left' || opts.direction == 'right') ? 1:0;//滚动类型，1左右，0上下
            var scrollId, rollId, isMove, marqueeId;
            var t,b,c,d,e; //滚动动画的参数,t:当前时间，b:开始的位置，c:改变的位置，d:持续的时间，e:结束的位置
            var _size, _len; //子元素的尺寸与个数
            var $nav,$navBtns;
            var arrPos = []; 
            var numView = 0; //当前所看子元素
            var numRoll=0; //轮换的次数
            var numMoved = 0;//已经移动的距离

            //防止滚动子元素比滚动元素宽而取不到实际滚动子元素宽度
            $element.css(_type?'width':'height',10000);
            //获取滚动元素的尺寸
            var navHtml = '<ul>';
            if (opts.isEqual) {
                _size = $kids[_type?'outerWidth':'outerHeight']();
                _len = $kids.length;
                scrollSize = _size * _len;
                for(var i=0;i<_len;i++){
                    arrPos.push(i*_size);
                    navHtml += '<li>'+ (i+1) +'</li>';
                }
            }else{
                $kids.each(function(i){
                    arrPos.push(scrollSize);
                    scrollSize += $(this)[_type?'outerWidth':'outerHeight']();
                    navHtml += '<li>'+ (i+1) +'</li>';
                });
            }
            navHtml += '</ul>';
            
            //滚动元素总尺寸小于容器尺寸，不滚动
            if (scrollSize<(_type?scrollW:scrollH)) return; 
            //克隆滚动子元素将其插入到滚动元素后，并设定滚动元素宽度
            $element.append($kids.clone()).css(_type?'width':'height',scrollSize*2);
            
            //轮换导航
            if (opts.navId) {
                $nav = $(opts.navId).append(navHtml).hover( stop, start );
                $navBtns = $('li', $nav);
                $navBtns.each(function(i){
                    $(this).bind(opts.eventNav,function(){
                        if(isMove) return;
                        if(numView==i) return;
                        rollFunc(arrPos[i]);
                        $navBtns.eq(numView).removeClass('navOn');
                        numView = i;
                        $(this).addClass('navOn');
                    });
                });
                $navBtns.eq(numView).addClass('navOn');
            }
            
            //设定初始位置
            if (opts.direction == 'right' || opts.direction == 'down') {
                _scrollObj[_type?'scrollLeft':'scrollTop'] = scrollSize;
            }else{
                _scrollObj[_type?'scrollLeft':'scrollTop'] = 0;
            }
            
            if(opts.isMarquee){
                //滚动开始
                //marqueeId = setInterval(scrollFunc, opts.scrollDelay);
                marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
                //鼠标划过停止滚动
                if(opts.mouseHover){
                    $marquee.hover(
                        function(){
                            clearInterval(marqueeId);
                        },
                        function(){
                            //marqueeId = setInterval(scrollFunc, opts.scrollDelay);
                            clearInterval(marqueeId);
                            marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
                        }
                    );
                }
                
                //控制加速运动
                if(opts.controlBtn){
                    $.each(opts.controlBtn, function(i,val){
                        $(val).bind(opts.eventA,function(){
                            opts.direction = i;
                            opts.oldAmount = opts.scrollAmount;
                            opts.scrollAmount = opts.newAmount;
                        }).bind(opts.eventB,function(){
                            opts.scrollAmount = opts.oldAmount;
                        });
                    });
                }
            }else{
                if(opts.isAuto){
                    //轮换开始
                    start();
                    
                    //鼠标划过停止轮换
                    $marquee.hover( stop, start );
                }
            
                //控制前后走
                if(opts.btnGo){
                    $.each(opts.btnGo, function(i,val){
                        $(val).bind(opts.eventGo,function(){
                            if(isMove == true) return;
                            opts.direction = i;
                            rollFunc();
                            if (opts.isAuto) {
                                stop();
                                start();
                            }
                        });
                    });
                }
            }
            
            function scrollFunc(){
                var _dir = (opts.direction == 'left' || opts.direction == 'right') ? 'scrollLeft':'scrollTop';
                
                if(opts.isMarquee){
                    if (opts.loop > 0) {
                        numMoved+=opts.scrollAmount;
                        if(numMoved>scrollSize*opts.loop){
                            _scrollObj[_dir] = 0;
                            return clearInterval(marqueeId);
                        } 
                    }
                    var newPos = _scrollObj[_dir]+(opts.direction == 'left' || opts.direction == 'up'?1:-1)*opts.scrollAmount;
                }else{
                    if(opts.duration){
                        if(t++<d){
                            isMove = true;
                            var newPos = Math.ceil(easeOutQuad(t,b,c,d));
                            if(t==d){
                                newPos = e;
                            }
                        }else{
                            newPos = e;
                            clearInterval(scrollId);
                            isMove = false;
                            return;
                        }
                    }else{
                        var newPos = e;
                        clearInterval(scrollId);
                    }
                }
                
                if(opts.direction == 'left' || opts.direction == 'up'){
                    if(newPos>=scrollSize){
                        newPos-=scrollSize;
                    }
                }else{
                    if(newPos<=0){
                        newPos+=scrollSize;
                    }
                }
                _scrollObj[_dir] = newPos;
                
                if(opts.isMarquee){
                    marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
                }else if(t<d){
                    if(scrollId) clearTimeout(scrollId);
                    scrollId = setTimeout(scrollFunc, opts.scrollDelay);
                }else{
                    isMove = false;
                }
                
            };
            
            function rollFunc(pPos){
                isMove = true;
                var _dir = (opts.direction == 'left' || opts.direction == 'right') ? 'scrollLeft':'scrollTop';
                var _neg = opts.direction == 'left' || opts.direction == 'up'?1:-1;

                numRoll = numRoll +_neg;
                //得到当前所看元素序号并改变导航CSS
                if(pPos == undefined&&opts.navId){
                    $navBtns.eq(numView).removeClass('navOn');
                    numView +=_neg;
                    if(numView>=_len){
                        numView = 0;
                    }else if(numView<0){
                        numView = _len-1;
                    }
                    $navBtns.eq(numView).addClass('navOn');
                    numRoll = numView;
                }

                var _temp = numRoll<0?scrollSize:0;
                t=0;
                b=_scrollObj[_dir];
                //c=(pPos != undefined)?pPos:_neg*opts.distance;
                e=(pPos != undefined)?pPos:_temp+(opts.distance*numRoll)%scrollSize;
                if(_neg==1){
                    if(e>b){
                        c = e-b;
                    }else{
                        c = e+scrollSize -b;
                    }
                }else{
                    if(e>b){
                        c =e-scrollSize-b;
                    }else{
                        c = e-b;
                    }
                }
                d=opts.duration;
                
                //scrollId = setInterval(scrollFunc, opts.scrollDelay);
                if(scrollId) clearTimeout(scrollId);
                scrollId = setTimeout(scrollFunc, opts.scrollDelay);
            }
            
            function start(){
                rollId = setInterval(function(){
                    rollFunc();
                }, opts.time*1000);
            }
            function stop(){
                clearInterval(rollId);
            }
            
            function easeOutQuad(t,b,c,d){
                return -c *(t/=d)*(t-2) + b;
            }
            
            function easeOutQuint(t,b,c,d){
                return c*((t=t/d-1)*t*t*t*t + 1) + b;
            }
        });
    };
    $.fn.superMarquee.defaults = {
        isMarquee:false,    //是否为Marquee
        isEqual:true,       //所有滚动的元素长宽是否相等,true,false
        loop: 0,            //循环滚动次数，0时无限
        newAmount:3,        //加速滚动的步长
        eventA:'mousedown', //鼠标事件，加速
        eventB:'mouseup',   //鼠标事件，原速
        isAuto:true,        //是否自动轮换
        time:5,             //停顿时间，单位为秒
        duration:50,        //缓动效果，单次移动时间，越小速度越快，为0时无缓动效果
        eventGo:'click',    //鼠标事件，向前向后走
        direction: 'up',  //滚动方向，'left','right','up','down'
        scrollAmount:1,     //步长
        scrollDelay:10,     //时长
        eventNav:'click',   //导航事件
        mouseHover:true     //鼠标经过
    };
    $.fn.superMarquee.setDefaults = function(settings) {
        $.extend( $.fn.superMarquee.defaults, settings );
    };  
})(jQuery);
///<jscompress sourcefile="jquery.superslide.js" />
/**
 * @filename jquery.superslide.js
 * @author Aniu[2014-12-15 08:07]
 * @update Aniu[2016-04-07 16:25]
 * @version v1.4.1
 * @description 超级幻灯片
 */

;!(function(window, document, $, undefined){
    var win = $(window);
    var SuperSlide = function(options){
        var that = this;
        that.options = $.extend(true, {
            target:null,
            //自动切换延迟时间
            delay:4000,
            //切换速度
            speed:450,
            //list按钮触发事件
            event:'click',
            //缓动效果，依赖jquery.easing.js
            ease:null,
            //一屏显示数量，<ul class="ui-slide"></ul>中不要使用li标签，会自动生成
            itemNum:0,
            //默认显示第几个
            moveTo:0,
            //切换图片为背景图片，<li data-src="背景图片路径"></li>
            isBackdrop:false,
            //是否以淡入淡出效果显示
            isFadein:false,
            //是否自动切换
            isAuto:true,
            //是否水平切换
            isHorz:true,
            //是否显示标题，<li data-title="文本或者html"></li>
            isTitle:false,
            //圆点按钮配置
            list:{
                //是否启用
                enable:true,
                //是否默认隐藏，鼠标悬停后显示
                isHide:false    
            },
            //左右切换按钮
            button:{
                enable:true,
                //是否默认隐藏，鼠标悬停后显示
                isHide:false
            },
            //相册底部缩略图
            thumb:{
                enable:false,
                //缩略图是否水平切换
                isHorz:true
            },
            //自适应切换
            resize:{
                enable:false,
                //默认全屏切换
                target:win,
                //水平切换表示最小宽度，垂直切换表示最小高度
                minSize:0,
                //窗口大小改变后回调函数
                callback:$.noop
            },
            //非循环滚动
            scroll:{
                enable:false,
                //是否默认显示最后一屏
                isEnd:false,
                //列表是否触发点击事件
                isEvent:true,
                /**
                 * @func 点击事件回调
                 * @param items <jQuery Obejct> 列表集合
                 * @param count <Number> 一屏展示数量
                 * @param index <Number> 一屏中第一个item索引
                 */
                callback:$.noop
            },
            /**
             * @func 切换中的回调函数，若非循环滚动，表示li标签触发event后的回调函数
             * @param index <Number> 当前展示item索引
             * @param item <jQuery Obejct> 当前展示item
             * @param dot <jQuery Obejct> 当前展示选中点控制器
             */
            callback:$.noop,
            /**
             * @func 切换后的回调函数
             * @param index <Number> 当前展示item索引
             * @param item <jQuery Obejct> 当前展示item jquery对象
             * @param dot <jQuery Obejct> 当前展示选中点控制器
             */
            endCallback:$.noop
        }, options);
        that.init();
    }
    
    SuperSlide.prototype = {
        init:function(){
            var that = this, options = that.options, target = options.target.css({position:'relative'});
            that.wrap = target.wrapInner('<div class="ui-slidewrap"></div>').children('.ui-slidewrap');
            that.scroll = that.wrap.children('.ui-slide');
            that.items = that.scroll.children();
            if(options.itemNum > 1){
                var temp;
                that.items.each(function(index){
                    if(index % options.itemNum === 0){
                        temp = $('<li></li>').appendTo(that.scroll);
                    }
                    temp.append($(this));
                });
                that.items = that.scroll.children();
            }
            that.itemSize = that.items.size();
            that.size = options.isHorz === true ? {type:'width', dir:'left'} : {type:'height', dir:'top'};
            that.moveTo = target.data('moveto')||options.moveTo;
            var type = that.size.type, dir = that.size.dir;
            that[type] = target[type]();
            if(options.resize.enable === true){
                var size = options.resize.target[type](), minSize = options.resize.minSize;
                that[type] = size >= minSize ? target[type](size)[type]() : target[type](minSize)[type]();
            }

            if(that.itemSize){
                that.index = 0;
                if(options.scroll.enable !== true){
                    that.items[type](that[type]);
                    that.timer = null;
                    that.createSlide();
                    if(that.moveTo > 0 && that.moveTo < that.itemSize && that.list){
                        that.list.find('span:eq('+ that.moveTo +')')[options.event]();
                    }
                    else{
                       that.slideMove();
                    }
                }
                else{
                    that.createScroll();
                }
                
                if(options.button.enable === true && that.button){
                    if(options.button.isHide === true){
                        target.hover(function(){
                            that.button.fadeIn();
                        }, function(){
                            that.button.stop(true, false).fadeOut();
                        });
                    }
                    else{
                        that.button.show();
                    }
                }
                
                if(options.list.enable === true && options.list.isHide === true && that.list){
                    target.hover(function(){
                        that.list.fadeIn();
                    }, function(){
                        that.list.stop(true, false).fadeOut();
                    });
                }
            }
        },
        createSlide:function(){
            var that = this, options = that.options, target = options.target, listItems = thumbItems ='', list;
            that.items.each(function(i, item){
                item = $(item);
                list = item.data('list') === undefined ? (i+1) : item.data('list');
                listItems += '<span>'+ list +'</span>';
                thumbItems += '<li><img src="'+ item.data('thumb') +'" /><i></i></li>';
            });
            if(options.isTitle === true){
                that.title = $('<div class="ui-slide-title"><span></span></div>').appendTo(target).find('span');
            }
            
            that.list = $('<div class="ui-slide-list">'+ listItems +'</div>').appendTo(target);
            
            if(that.itemSize > 1){
                
                if(options.button.enable === true){
                    that.button = $('<span class="ui-slide-btn ui-slide-prev"></span><span class="ui-slide-btn ui-slide-next"></span>').appendTo(target);
                }
                if(options.thumb.enable === true){
                    that.thumb = new SuperSlide({
                        target:$('<div class="ui-slide-scroll"><ul class="ui-slide">'+ thumbItems +'</ul></div>').appendTo(target),
                        speed:450,
                        isHorz:options.thumb.isHorz,
                        button:{
                            enable:true
                        },
                        scroll:{
                            enable:true
                        },
                        callback:function(index){
                            that.thumbClick = true;
                            that.index = index;
                            that.slideMove();
                        }
                    });
                }
                
                if(options.isFadein !== true){
                    var oneItem = that.items.eq(0);
                    if(options.isBackdrop === true){
                        oneItem.css({backgroundImage:'url('+ oneItem.data('src') +')'});
                    }
                    else{
                       oneItem.find('img').each(function(){
                            var crt = $(this);
                            !crt.attr('src') && crt.attr('src', crt.data('src'));
                        });
                    }
                    that.scroll.append(oneItem.clone())[that.size.type]((that.itemSize+1)*that[that.size.type]);
                    that.items = that.scroll.children();
                }
                else{
                    that.scroll.css({position:'relative'});
                    that.items.css({position:'absolute'}).hide();
                }

                that.slideEvent();
            }
            else{
                options.list.enable = false;
            }
            
            if(options.list.enable !== true){
                that.list.hide();
            }
            
            return that;
        },
        slideEvent:function(){
            var that = this, options = that.options, target = options.target;
            that.list.on(options.event || 'click', 'span', function(){
                that.thumbClick = false;
                that.index = $(this).index();
                that.slideMove();
            });
            that.button && that.button.click(function(){
                that.thumbClick = false;
                if($(this).hasClass('ui-slide-prev')){
                    if(options.thumb.enable === true && that.index == 0){
                        return false;
                    }
                    that.slidePrev();
                }
                else{
                    if(options.thumb.enable === true && that.index == that.itemSize-1){
                        return false;
                    }
                    that.slideNext();
                }
            });
            if(options.resize.enable === true){
                var size, minSize, type = that.size.type, dir = that.size.dir;
                win.resize(function(){
                    size = options.resize.target[type]();
                    minSize = options.resize.minSize;
                    that[type] = size >= minSize ? target[type](size)[type]() : target[type](minSize)[type]();
                    that.items[type](that[type]);
                    if(options.isFadein !== true){
                        that.scroll.css(dir, -that.index*that[type])[type](that[type]*(that.itemSize+1));
                    }
                    typeof options.resize.callback === 'function' && options.resize.callback();
                });
            }
            if(options.isAuto === true){
                that.autoplay();
                target.hover(function(){
                    clearInterval(that.timer);
                }, function(){
                    that.autoplay();
                });
            }
            return that;
        },
        slideMove:function(isPrev){
            var that = this, options = that.options, index = that.index, item = that.items.eq(index), crt;
            var dot = that.list.children('span:eq('+ index +')');
            if(!that.thumbClick && options.thumb.enable === true){
                var thumb = that.thumb, thumbLeft = Math.abs(thumb.scroll.position()[thumb.setting.dir]),
                    thumbNum = (thumbLeft+(thumb.cOutline))/thumb.outline;
                if(isPrev === true && thumbNum-thumb.count == index+1){
                    thumb.button.first().click();
                }
                else if(index === thumbNum){
                    thumb.button.last().click();
                }
                thumb.items.eq(index).addClass('s-crt').siblings().removeClass('s-crt');
            }
            if(options.isBackdrop === true){
                crt = item;
                crt.css({backgroundImage:'url('+ crt.data('src') +')'});
            }
            else{
                item.find('img').each(function(){
                    crt = $(this);
                    !crt.attr('src') && crt.attr('src', crt.data('src'));
                });
            }
            if(options.isFadein !== true){
                var animate = {};
                animate[that.size.dir] = -index*that[that.size.type];
                that.scroll.stop(true, false).animate(animate, options.speed, options.ease, function(){
                    typeof options.endCallback == 'function' && options.endCallback(index, item, dot);
                });
                animate = null;
            }
            else{
                item.fadeIn(options.speed).siblings().stop(true, false).fadeOut(options.speed, function(){
                    typeof options.endCallback == 'function' && options.endCallback(index, item, dot);
                });
            }
            that.title && that.title.html(item.data('title'));
            index = index < that.itemSize ? index : 0;
            dot = that.list.children('span:eq('+ index +')');
            typeof options.callback == 'function' && options.callback(index, item, dot);
            dot.addClass('s-crt').siblings().removeClass('s-crt');
        },
        slidePrev:function(){
            var that = this, options = that.options;
            if(options.thumb.enable === true && that.index == 0){
                return false;
            }
            if(options.isFadein !== true){
                if(!that.scroll.is(':animated')){
                    if(that.index == 0){
                        that.index = that.itemSize;
                        that.scroll.css(that.size.dir, -that[that.size.type]*that.index);
                    }
                    that.index -= 1;
                    that.slideMove(true);
                }
            }
            else if(!that.items.is(':animated')){
                that.index = that.index == 0 ? that.itemSize-1 : --that.index;
                that.slideMove(true);
            }
        },
        slideNext:function(){
            var that = this, options = that.options;
            if(options.isFadein !== true){
                if(!that.scroll.is(':animated')){
                    if(that.index == that.itemSize){
                        that.index = 0;
                        that.scroll.css(that.size.dir, 0);
                    }
                    that.index += 1;
                    that.slideMove();
                }
            }
            else if(!that.items.is(':animated')){
                that.index = that.index == (that.itemSize-1) ? 0 : ++that.index;
                that.slideMove();
            }
        },
        createScroll:function(isReset){
            var that = this, options = that.options, target = options.target;
            that.setting = {
                dir:'left',
                m1:'marginRight', 
                m2:'marginLeft', 
                outline:'width',
                outer:'outerWidth'
            }
            if(options.isHorz !== true){
                that.setting = {
                    dir:'top',
                    m1:'marginTop',
                    m2:'marginBottom',
                    outline:'height',
                    outer:'outerHeight'
                }
            }
            options.button = {
                enable:true,
                isHide:false
            }
            options.list.enable = false;
            that.button = $('<span class="ui-slide-btn ui-slide-prev"></span><span class="ui-slide-btn ui-slide-next"></span>').appendTo(target);
            that.outline  = that.items[that.setting.outer]() + parseInt(that.items.css(that.setting.m1)) + parseInt(that.items.css(that.setting.m2));
            that.count  = Math.ceil(that.wrap[that.setting.outline]()/that.outline);
            that.cOutline = that.outline*that.count;
            that.scrollVal = that.outline*that.itemSize - that.cOutline;
            that.scroll[that.setting.outline](that.scrollVal + that.cOutline);
            that.button.removeClass('s-crt');
            if(that.itemSize<=that.count){
                that.button.addClass('s-dis');
            }
            if(!isReset){
                that.moveTo = 0;
                that.scrollEvent();
            }
            
            return that;
        },
        scrollEvent:function(){
            var that = this, options = that.options, target;
            that.button.on('click', function(){
                target = $(this);
                if(!target.hasClass('s-dis')){
                    var dir = Math.abs(that.scroll.position()[that.setting.dir]);
                    if(target.hasClass('ui-slide-prev')){
                        if(dir > that.cOutline){
                            if(!that.moveTo){
                                that.index = -that.cOutline;
                            }
                            else{
                                that.index = -that.moveTo;
                                that.moveTo = 0;
                            }
                            that.scrollMove(target, false);
                        }
                        else{
                            that.moveTo = that.index = -dir;    
                            that.scrollMove(target, true);
                        }
                    }
                    else{
                        var sval = that.scrollVal-dir;
                        that.moveTo = Math.abs(that.moveTo);
                        if(sval-that.cOutline>0){
                            if(!that.moveTo){
                                that.index = that.cOutline; 
                            }
                            else{
                                that.index = that.moveTo;
                                that.moveTo = 0;
                            }
                            that.scrollMove(target, false);
                        }
                        else{
                            that.moveTo = that.index = sval;    
                            that.scrollMove(target, true);
                        }   
                    }
                }
            });
            
            options.scroll.isEvent && that.items.on(options.event, function(){
                var me = $(this);
                 typeof options.callback == 'function' && options.callback(me.index(), me);
                 $(this).addClass('s-crt').siblings().removeClass('s-crt');
            });
            if(options.scroll.isEnd === true){
                that.index = that.itemSize*that.outline-that.cOutline;
                that.scrollMove(that.button.last(), true, 0);
            }
            else if(options.moveTo > 0){
                var moveTo = options.moveTo + 1, step = Math.ceil(that.count/2), temp = moveTo-step;
                if(temp <= 0){
                    that.scrollMove(that.button.first(), true, 0);
                }
                else if(temp+step*2 > that.itemSize){
                    that.index = that.itemSize*that.outline-that.cOutline;
                    that.scrollMove(that.button.last(), true, 0);
                }
                else{
                    that.index = temp*that.outline;
                    that.scrollMove(that.button.first(), false, 0);
                }
                options.scroll.isEvent && that.items.eq(options.moveTo)[options.event]();
            }
            else{
                that.scrollMove(that.button.first(), true, 0);
            }
        },
        scrollMove:function(target, isDis, speed){
            var that = this, options = that.options, animate = {};
            speed = speed === undefined ? options.speed : speed;
            if(!that.scroll.is(':animated')){
                animate[that.setting.dir] = '-='+that.index+'px';
                that.scroll.stop(true, false).animate(animate, speed, function(){
                    that.itemSize>that.count && target.siblings('.ui-slide-btn').removeClass('s-dis');
                    if(isDis === true){
                        target.addClass('s-dis');
                    } 
                    options.scroll.callback(that.items, that.count, Math.abs($(this).position()[that.setting.dir]/that.outline));
                });
                animate = null;
            }
        },
        resetItem:function(){
            var that = this;
            that.items = that.scroll.children();
            that.itemSize = that.items.size();
            that.createScroll(true);
        },
        autoplay:function(){
            var that = this, options = that.options;
            that.timer = setInterval(function(){
                that.slideNext();
            }, options.delay);
        }
    }
    
    $.fn.superSlide = function(options){
        options = options || {};
        return this.each(function(){
            options.target = $(this);
            this.set = new SuperSlide(options);
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.tab.js" />
/**
 * @filename jquery.tab.js
 * @author Aniu[2014-04-21 09:46]
 * @update Aniu[2016-03-24 16:28]
 * @version v1.5
 * @description 选项卡
 */

;!(function(window, document, $, undefined){
    $.fn.tab = function(o){
        o = $.extend({
            /**
             * @function 触发事件 click/mouseover
             * @type <String>
             */
            event:'click',
            /**
             * @function 是否自动切换 true/false
             * @type <Boolean>
             */
            auto:false,
            /**
             * @function 自动切换延迟时间
             * @type <Number>
             */
            delay:4000,
            /**
             * @function 默认展示菜单索引
             * @type <Number>
             */
            index:0,
            /**
             * @function 指定ajax数据容器元素，为空则指向最外层容器
             * @type <String>
             */
            content:'',
            /**
             * @function ajax请求数据
             * @type <Function>
             * @return <Undefined>
             * @param index <Number> 展示状态选项卡索引
             * @param item <jQuery Object> 展示内容区域容器对象
             */
            ajax:$.noop,
            /**
             * @function 展示内容之前回调函数
             * @type <Function>
             * @return <Boolean>
             * @param index <Number> 展示状态选项卡索引
             * @param item <jQuery Object> 展示内容区域容器对象
             * @desc 返回false则不展示对应内容区域
             */
            callback:$.noop,
            /**
             * @function 展示内容之后回调函数
             * @type <Function>
             * @return <Undefined>
             * @param index <Number> 展示状态选项卡索引
             * @param item <jQuery Object> 展示内容区域容器对象
             */
            endCallback:$.noop
        }, o||{});
        
        return this.each(function(){
            var _this = this, me = $(_this);
            if(!me.children('.ui-tabody').length){
                me.append('<div class="ui-tabody"></div>');
            }
            var index = 0, timer1 = timer2 = null,
                that = me.children('.ui-tab').show(),
                size = that.children('li').size(),
                body = me.children('.ui-tabody');
                
            _this.addItem = function(data){
                if($.isArray(data)){
                    var i = 0, len = data.length, temp, btn;
                    for(i; i<len; i++){
                        temp = data[i];
                        temp.tabmenu && (btn = $(temp.tabmenu).appendTo(that));
                        temp.tabcon && $(temp.tabcon).appendTo(body).hide();
                    }
                    return btn;
                }
            }
            
            _this.removeItem = function(index, nextall){
                if(!nextall){
                    that.children().eq(index).remove();
                    body.children().eq(index).remove();
                }
                else{
                    that.children().eq(index).nextAll().remove();
                    body.children().eq(index).nextAll().remove();
                }
            }

            that.children('li').children('a').siblings().appendTo(body).not(':eq(0)').hide();
            
            that.on(o.event, 'li', function(){
                var i = $(this).index();
                if(o.event == 'click'){
                    show(i);
                }
                else{
                    timer1 = setTimeout(function(){
                        show(i);
                    }, 150);
                }
                index = i;  
            }).children().eq(o.index).trigger(o.event);
            
            if(o.event === 'mouseover'){
                that.on('mouseout', 'li', function(){
                    clearTimeout(timer1);
                });
            }
            
            function show(index){
                var item = body.children(':eq(' + index + ')'), img = item.find('img'), content = o.content ? item.find(o.content).children()[0] : item.children()[0];
                if(o.callback(index, item) === false){
                    return false;
                }
                !content && o.ajax(index, item);
                (!!img.data('src') && (img.attr('src') !== img.data('src'))) && img.attr('src', img.data('src'));
                that.children('li:eq(' + index + ')').addClass('s-crt').siblings().removeClass('s-crt');
                item.show().siblings().hide();
                if(!item.attr('once')){
                    if(o.endCallback(index, item) === false){
                        item.attr('once', 'true');
                    }
                }
            } 

            if(o.auto == true){
                timer2 = setInterval(function(){
                    index < size - 1 ? index++ : index = 0;
                    show(index);
                }, o.delay);
                
                $(this).hover(function(){
                    clearInterval(timer2);
                },function(){
                    timer2 = setInterval(function(){
                        index < size - 1 ? index++ : index = 0;
                        show(index);
                    }, o.delay);
                });
            }
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.timer.js" />
/**
 * @filename jquery.timer.js
 * @author Aniu[2015-01-04 09:48]
 * @update Aniu[2015-07-24 19:29]
 * @version v1.3
 * @description data-starttime  倒计时开始时间，默认为当前系统时间
 *              data-readytime  活动开始前准备时间，例如活动开始前几分钟需要改变一些状态，默认空
 *              data-begintime  活动开始时间，必须值
 *              data-endtime    活动结束时间，必须值
 *              data-beforetime 结束前某一时间，默认空
 */
 
;!(function(window, document, $, undefined){
    $.fn.timer = function(o){
        o = $.extend({
            /**
             * @func 创建倒计时html骨架
             * @type <Function>
             * @param target <jQuery Object> 调用组件的当前对象
             * @param dayArray <Array> 剩余天数数组
             * @param dateArray <Array> 剩时间数组不包含天数
             * @param dateUnit <Array> ['时', '分', '秒']
             */
            createHtml:function(target, dayArray, dateArray, dateUnit){
                var html = day = '', i, j, k, temp;
                if(dayArray[0] != 0){
                    html += '<span>';
                    for(i in dayArray){
                        html += '<em>'+ dayArray[i] +'</em>';
                    }
                    html += '</span><b>天</b>';
                    dateArray = dateArray.slice(dayArray.length);
                }
                for(i in dateUnit){
                    html += '<span>';
                    temp = dateArray.slice(k=i*2, k+2);
                    for(j in temp){
                        html += '<em>'+ temp[j] +'</em>';
                    }
                    html += '</span><b>'+ dateUnit[i] +'</b>';
                }
                target.html(html);
            },
            /**
             * @func 倒计时运行回调函数
             * @type <Function>
             * @return <Boolean> 返回true则会立即终止当前倒计时
             * @param target <jQuery Object> 调用组件的当前对象
             * @param dayArray <Array> 剩余天数数组
             * @param dateArray <Array> 剩时间数组，若天数为0，会被移除
             * @param dateUnit <Array> ['时', '分', '秒']
             */
            runCallback:function(target, dayArray, dateArray, dateUnit){
                this.createHtml(target, dayArray, dateArray, dateUnit);
            },
            /**
             * @func 活动倒计时进行中时调用,用于初始化进行中倒计时，仅调用一次
             * @type <Function>
             * @param target <jQuery Object> 调用组件的当前对象
             */
            runningCallback:$.noop,
            /**
             * @func 结束前回调函数，搭配data-beforetime使用
             * @type <Function>
             * @return <Boolean> 返回false仅执行一次
             * @param target <jQuery Object> 调用组件的当前对象
             */
            beforeCallback:$.noop,
            /**
             * @func 准备阶段回调函数
             * @type <Function>
             * @return <Boolean> 返回false仅执行一次
             * @param target <jQuery Object> 调用组件的当前对象
             */
            readyCallback:$.noop,
            /**
             * @func 倒计时结束回调函数
             * @type <Function>
             * @param target <jQuery Object> 调用组件的当前对象
             */
            endCallback:function(target){
                target.html('<span><em>活动已结束</em></span>');
            }
        }, o||{});
        var getTime = function(date){
            return new Date(date).getTime();
        }
        return this.each(function(){
            var _this = $(this), delay = 1000, timeout = null, data = _this.data(), status = 1, //1未开始 2进行中
                starttime = data.starttime ? getTime(data.starttime) : new Date().getTime(),
                readytime = data.readytime ? getTime(data.readytime) : null,
                begintime = getTime(data.begintime), _begintime = begintime, endtime = getTime(data.endtime),
                beforetime = data.beforetime ? getTime(data.beforetime) : null, system = [new Date().getTime()], 
                ready = true, before = true, isStop = false, isAuto = false, //是否自动切换到进行中的倒计时，如果在进行中，用户刷新页面，将自动创建进行中的倒计时，之后必须设为true
                dateArray = [], dayArray = [], dateUnit = ['时', '分', '秒'],
                running = function(isInit){
                    var day = hour = minute = second = 0, time = begintime - starttime, underway = starttime>=begintime && starttime<endtime && !isAuto;
                    if(underway || ((isAuto=true) && time>0 && !isStop)){
                        delay = 1000;
                        if(underway){
                            begintime = endtime;
                            time = begintime - starttime;
                            status = 2;
                            delay = 0;
                            o.runningCallback(_this);
                        }
                        day = Math.floor(time/86400000);
                        time -= day*86400000;
                        hour = Math.floor(time/3600000);
                        time -= hour*3600000;
                        minute = Math.floor(time/60000);
                        time -= minute*60000;
                        second = Math.floor(time/1000);
                        if(hour<10){hour='0'+hour;}
                        if(minute<10){minute='0'+minute;}
                        if(second<10){second='0'+second;}
                        dateArray = (day+''+hour+''+minute+''+second).split('');
                        dayArray = dateArray.slice(0, -6);
                        if(isInit == true){
                            o.createHtml(_this, dayArray, dateArray.slice(dayArray.length), dateUnit);
                        }
                        else{
                            dayArray[0] == 0 && dateArray.shift();
                            isStop = o.runCallback(_this.data('starttime', starttime), dayArray, dateArray, dateUnit, status);
                            if(isStop){
                                delay = 0;
                            }
                        }
                        if(beforetime && starttime >= beforetime && before !== false){
                            before = o.beforeCallback(_this);
                        }
                        if(readytime && readytime <=starttime && starttime < _begintime && ready !== false){
                            ready = o.readyCallback(_this);
                        }

                        //不能加等于1000，因为不同浏览器对js的渲染速度不一样，会导致时间延迟，应该获取系统时间的差值
                        system.push(new Date().getTime());
                        system.length > 2 && system.shift();
                        starttime += (system[1] - system[0]);
                        isAuto = true;
                    }
                    else{
                        o.endCallback(_this, starttime);
                        clearTimeout(timeout);
                        return;
                    }
                    timeout = setTimeout(running, delay);
                }
            running(true);
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.tips.js" />
/**
 * @filename jquery.tips.js
 * @author Aniu[2014-3-16 19:40]
 * @update Aniu[2015-06-21 15:33]
 * @version v1.3
 * @description 模拟html5的placeholder效果
 */

;!(function(window, document, $, undefined){
    $.fn.tips = function(o){
        o = $.extend({
            /**
             * @func 是否启用动画版
             * @type <Boolean>
             */
            animate:true,
            /**
             * @func 输入框值是否可以和占位符相同
             * @type <Boolean>
             */
            equal:false,
            /**
             * @func 占位符文本颜色
             * @type <String>
             */
            color:'#ccc',
            /**
             * @func 类选择器值，可对占位符设置样式
             * @type <String>
             */
            theme:''
        }, o||{});
        return this.each(function(){
            var that = $(this), ph = $.trim(that.data('tips'));
            if(!!ph){
                //that.removeAttr('placeholder');
                
                if(!$.trim(that.val())){
                    that.val('');
                }
                
                var data = {
                    pleft:parseInt(that.css('paddingLeft')),
                    ptop:parseInt(that.css('paddingTop')),
                    height:that.outerHeight()
                };
                
                var txt = $('<b>'+ ph +'</b>').appendTo(that.wrap('<strong />').parent().css({
                    position:'relative',
                    display:'inline-block',
                    width:that.outerWidth(),
                    overflow:'hidden',
                    cursor:'text'
                }).addClass(o.theme)).css($.extend({
                    position:'absolute',
                    left:data.pleft+1,
                    top:data.ptop,
                    height:data.height,
                    lineHeight:data.height+'px',
                    color:o.color
                }, that.is('textarea') ? {lineHeight:'normal', height:'auto'} : {})).on('click', function(){
                    that.focus();
                });
                
                that.on('focus', function(){
                    o.animate === true && txt.stop(false, true).animate({left:data.pleft+10, opacity:'0.5'});
                }).on('blur change', function(){
                    var val = $.trim(that.val());
                    if((o.equal === false && val == ph) || !val){
                        that.val('');
                        txt.show();
                        o.animate === true && txt.animate({left:data.pleft+1, opacity:'1'});
                    }
                    else{
                        txt.hide();
                    }
                }).on('keyup keydown', function(){
                    $.trim(that.val()) ? txt.hide() : txt.show();
                }).blur();
            }
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="jquery.upload.js" />
/**
 * @filename jquery.upload.js
 * @author Aniu[2014-12-17 12:14]
 * @update Aniu[2015-04-28 14:34]
 * @version v1.3
 * @description 文件上传，后台响应的content-type值必须为text/html
 */

;!(function(window, document, $, undefined){
    $.fn.upload = function(o){
        o = $.extend({
            url:'',
            timeout:25000,
            dataType:'json', //json html text
            /**
             * @func 文件选择后执行回调函数，可做类型验证
             * @return <Boolean>
             * @param that <jQuery Object> 当前file jquery对象
             */
            start:null,
            /**
             * @func ajax交互成功时回调函数
             * @param data <Response JSON> 返回json数据
             * @param that <jQuery Object> 当前file jquery对象
             */
            success:$.noop,
            /**
             * @func ajax交互失败时回调函数
             * @param that <jQuery Object> 当前file jquery对象
             */
            error:$.noop
        }, o||{});
        return this.each(function(){
            var that = $(this);
            if(that.is(':file')){
                var iframe = $('iframe[name="uploadfile"]'), timer = null,
                    type = o.dataType === 'json' ? 'text' : o.dataType,
                    form, val, timeout, response, body, clone,
                    request = function(){
                        timer = setTimeout(function(){
                            timeout -= 100;
                            body = iframe.contents().find('body');
                            response = body[type]();
                            if(response || timeout <= 0){
                                clearTimeout(timer);
                                if(timeout <= 0){
                                    o.error(clone); //超时
                                }
                                else{
                                    if(o.dataType === 'json'){
                                        if(/^{[\s\S]*}$/.test(response)){
                                            eval('var data = '+response);
                                            o.success(data, clone);
                                        }
                                        else{
                                            o.error(clone); //格式错误
                                        }
                                    }
                                    else{
                                        o.success(response, clone);
                                    }
                                }
                                body.empty();
                                return;
                            }
                            request();
                        }, 100);
                }
                if(!iframe[0]){
                    iframe = $('<iframe name="uploadfile"></iframe>\
                                <form method="post" action="'+ o.url +'" target="uploadfile" enctype="multipart/form-data"></form>').appendTo('body').hide().first();
                }
                form = iframe.next('form');
                that.change(function(){
                    clearTimeout(timer);
                    timeout = o.timeout;
                    if((typeof o.start === 'function' && !o.start(that)) || !that.val()){
                        return;
                    }
                    clone = that.before(that.clone()).prev().upload(o);
                    form.children().remove().end().html(that).submit();
                    request();
                });
            }
        });
    }
})(this, document, jQuery);
///<jscompress sourcefile="template-debug.js" />
/*!
 * artTemplate - Template Engine
 * https://github.com/aui/artTemplate
 * Released under the MIT, BSD, and GPL Licenses
 */
 
!(function () {


/**
 * 模板引擎
 * @name    template
 * @param   {String}            模板名
 * @param   {Object, String}    数据。如果为字符串则编译并缓存编译结果
 * @return  {String, Function}  渲染好的HTML字符串或者渲染方法
 */
var template = function (filename, content) {
    return typeof content === 'string'
    ?   compile(content, {
            filename: filename
        })
    :   renderFile(filename, content);
};


template.version = '3.0.0';


/**
 * 设置全局配置
 * @name    template.config
 * @param   {String}    名称
 * @param   {Any}       值
 */
template.config = function (name, value) {
    defaults[name] = value;
};



var defaults = template.defaults = {
    openTag: '<%',    // 逻辑语法开始标签
    closeTag: '%>',   // 逻辑语法结束标签
    escape: true,     // 是否编码输出变量的 HTML 字符
    cache: true,      // 是否开启缓存（依赖 options 的 filename 字段）
    compress: false,  // 是否压缩输出
    parser: null      // 自定义语法格式器 @see: template-syntax.js
};


var cacheStore = template.cache = {};


/**
 * 渲染模板
 * @name    template.render
 * @param   {String}    模板
 * @param   {Object}    数据
 * @return  {String}    渲染好的字符串
 */
template.render = function (source, options) {
    return compile(source, options);
};


/**
 * 渲染模板(根据模板名)
 * @name    template.render
 * @param   {String}    模板名
 * @param   {Object}    数据
 * @return  {String}    渲染好的字符串
 */
var renderFile = template.renderFile = function (filename, data) {
    var fn = template.get(filename) || showDebugInfo({
        filename: filename,
        name: 'Render Error',
        message: 'Template not found'
    });
    return data ? fn(data) : fn;
};


/**
 * 获取编译缓存（可由外部重写此方法）
 * @param   {String}    模板名
 * @param   {Function}  编译好的函数
 */
template.get = function (filename) {

    var cache;
    
    if (cacheStore[filename]) {
        // 使用内存缓存
        cache = cacheStore[filename];
    } else if (typeof document === 'object') {
        // 加载模板并编译
        var elem = document.getElementById(filename);
        
        if (elem) {
            var source = (elem.value || elem.innerHTML)
            .replace(/^\s*|\s*$/g, '');
            cache = compile(source, {
                filename: filename
            });
        }
    }

    return cache;
};


var toString = function (value, type) {

    if (typeof value !== 'string') {

        type = typeof value;
        if (type === 'number') {
            value += '';
        } else if (type === 'function') {
            value = toString(value.call(value));
        } else {
            value = '';
        }
    }

    return value;

};


var escapeMap = {
    "<": "&#60;",
    ">": "&#62;",
    '"': "&#34;",
    "'": "&#39;",
    "&": "&#38;"
};


var escapeFn = function (s) {
    return escapeMap[s];
};

var escapeHTML = function (content) {
    return toString(content)
    .replace(/&(?![\w#]+;)|[<>"']/g, escapeFn);
};


var isArray = Array.isArray || function (obj) {
    return ({}).toString.call(obj) === '[object Array]';
};


var each = function (data, callback) {
    var i, len;        
    if (isArray(data)) {
        for (i = 0, len = data.length; i < len; i++) {
            callback.call(data, data[i], i, data);
        }
    } else {
        for (i in data) {
            callback.call(data, data[i], i);
        }
    }
};


var utils = template.utils = {

	$helpers: {},

    $include: renderFile,

    $string: toString,

    $escape: escapeHTML,

    $each: each
    
};/**
 * 添加模板辅助方法
 * @name    template.helper
 * @param   {String}    名称
 * @param   {Function}  方法
 */
template.helper = function (name, helper) {
    helpers[name] = helper;
};

var helpers = template.helpers = utils.$helpers;




/**
 * 模板错误事件（可由外部重写此方法）
 * @name    template.onerror
 * @event
 */
template.onerror = function (e) {
    var message = 'Template Error\n\n';
    for (var name in e) {
        message += '<' + name + '>\n' + e[name] + '\n\n';
    }
    
    if (typeof console === 'object') {
        console.error(message);
    }
};


// 模板调试器
var showDebugInfo = function (e) {

    template.onerror(e);
    
    return function () {
        return '{Template Error}';
    };
};


/**
 * 编译模板
 * 2012-6-6 @TooBug: define 方法名改为 compile，与 Node Express 保持一致
 * @name    template.compile
 * @param   {String}    模板字符串
 * @param   {Object}    编译选项
 *
 *      - openTag       {String}
 *      - closeTag      {String}
 *      - filename      {String}
 *      - escape        {Boolean}
 *      - compress      {Boolean}
 *      - debug         {Boolean}
 *      - cache         {Boolean}
 *      - parser        {Function}
 *
 * @return  {Function}  渲染方法
 */
var compile = template.compile = function (source, options) {
    
    // 合并默认配置
    options = options || {};
    for (var name in defaults) {
        if (options[name] === undefined) {
            options[name] = defaults[name];
        }
    }


    var filename = options.filename;


    try {
        
        var Render = compiler(source, options);
        
    } catch (e) {
    
        e.filename = filename || 'anonymous';
        e.name = 'Syntax Error';

        return showDebugInfo(e);
        
    }
    
    
    // 对编译结果进行一次包装

    function render (data) {
        
        try {
            
            return new Render(data, filename) + '';
            
        } catch (e) {
            
            // 运行时出错后自动开启调试模式重新编译
            if (!options.debug) {
                options.debug = true;
                return compile(source, options)(data);
            }
            
            return showDebugInfo(e)();
            
        }
        
    }
    

    render.prototype = Render.prototype;
    render.toString = function () {
        return Render.toString();
    };


    if (filename && options.cache) {
        cacheStore[filename] = render;
    }

    
    return render;

};




// 数组迭代
var forEach = utils.$each;


// 静态分析模板变量
var KEYWORDS =
    // 关键字
    'break,case,catch,continue,debugger,default,delete,do,else,false'
    + ',finally,for,function,if,in,instanceof,new,null,return,switch,this'
    + ',throw,true,try,typeof,var,void,while,with'

    // 保留字
    + ',abstract,boolean,byte,char,class,const,double,enum,export,extends'
    + ',final,float,goto,implements,import,int,interface,long,native'
    + ',package,private,protected,public,short,static,super,synchronized'
    + ',throws,transient,volatile'

    // ECMA 5 - use strict
    + ',arguments,let,yield'

    + ',undefined';

var REMOVE_RE = /\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|\s*\.\s*[$\w\.]+/g;
var SPLIT_RE = /[^\w$]+/g;
var KEYWORDS_RE = new RegExp(["\\b" + KEYWORDS.replace(/,/g, '\\b|\\b') + "\\b"].join('|'), 'g');
var NUMBER_RE = /^\d[^,]*|,\d[^,]*/g;
var BOUNDARY_RE = /^,+|,+$/g;
var SPLIT2_RE = /^$|,+/;


// 获取变量
function getVariable (code) {
    return code
    .replace(REMOVE_RE, '')
    .replace(SPLIT_RE, ',')
    .replace(KEYWORDS_RE, '')
    .replace(NUMBER_RE, '')
    .replace(BOUNDARY_RE, '')
    .split(SPLIT2_RE);
};


// 字符串转义
function stringify (code) {
    return "'" + code
    // 单引号与反斜杠转义
    .replace(/('|\\)/g, '\\$1')
    // 换行符转义(windows + linux)
    .replace(/\r/g, '\\r')
    .replace(/\n/g, '\\n') + "'";
}


function compiler (source, options) {
    
    var debug = options.debug;
    var openTag = options.openTag;
    var closeTag = options.closeTag;
    var parser = options.parser;
    var compress = options.compress;
    var escape = options.escape;
    

    
    var line = 1;
    var uniq = {$data:1,$filename:1,$utils:1,$helpers:1,$out:1,$line:1};
    


    var isNewEngine = ''.trim;// '__proto__' in {}
    var replaces = isNewEngine
    ? ["$out='';", "$out+=", ";", "$out"]
    : ["$out=[];", "$out.push(", ");", "$out.join('')"];

    var concat = isNewEngine
        ? "$out+=text;return $out;"
        : "$out.push(text);";
          
    var print = "function(){"
    +      "var text=''.concat.apply('',arguments);"
    +       concat
    +  "}";

    var include = "function(filename,data){"
    +      "data=data||$data;"
    +      "var text=$utils.$include(filename,data,$filename);"
    +       concat
    +   "}";

    var headerCode = "'use strict';"
    + "var $utils=this,$helpers=$utils.$helpers,"
    + (debug ? "$line=0," : "");
    
    var mainCode = replaces[0];

    var footerCode = "return new String(" + replaces[3] + ");"
    
    // html与逻辑语法分离
    forEach(source.split(openTag), function (code) {
        code = code.split(closeTag);
        
        var $0 = code[0];
        var $1 = code[1];
        
        // code: [html]
        if (code.length === 1) {
            
            mainCode += html($0);
         
        // code: [logic, html]
        } else {
            
            mainCode += logic($0);
            
            if ($1) {
                mainCode += html($1);
            }
        }
        

    });
    
    var code = headerCode + mainCode + footerCode;
    
    // 调试语句
    if (debug) {
        code = "try{" + code + "}catch(e){"
        +       "throw {"
        +           "filename:$filename,"
        +           "name:'Render Error',"
        +           "message:e.message,"
        +           "line:$line,"
        +           "source:" + stringify(source)
        +           ".split(/\\n/)[$line-1].replace(/^\\s+/,'')"
        +       "};"
        + "}";
    }
    
    
    
    try {
        
        
        var Render = new Function("$data", "$filename", code);
        Render.prototype = utils;

        return Render;
        
    } catch (e) {
        e.temp = "function anonymous($data,$filename) {" + code + "}";
        throw e;
    }



    
    // 处理 HTML 语句
    function html (code) {
        
        // 记录行号
        line += code.split(/\n/).length - 1;

        // 压缩多余空白与注释
        if (compress) {
            code = code
            .replace(/\s+/g, ' ')
            .replace(/<!--[\w\W]*?-->/g, '');
        }
        
        if (code) {
            code = replaces[1] + stringify(code) + replaces[2] + "\n";
        }

        return code;
    }
    
    
    // 处理逻辑语句
    function logic (code) {

        var thisLine = line;
       
        if (parser) {
        
             // 语法转换插件钩子
            code = parser(code, options);
            
        } else if (debug) {
        
            // 记录行号
            code = code.replace(/\n/g, function () {
                line ++;
                return "$line=" + line +  ";";
            });
            
        }
        
        
        // 输出语句. 编码: <%=value%> 不编码:<%=#value%>
        // <%=#value%> 等同 v2.0.3 之前的 <%==value%>
        if (code.indexOf('=') === 0) {

            var escapeSyntax = escape && !/^=[=#]/.test(code);

            code = code.replace(/^=[=#]?|[\s;]*$/g, '');

            // 对内容编码
            if (escapeSyntax) {

                var name = code.replace(/\s*\([^\)]+\)/, '');

                // 排除 utils.* | include | print
                
                if (!utils[name] && !/^(include|print)$/.test(name)) {
                    code = "$escape(" + code + ")";
                }

            // 不编码
            } else {
                code = "$string(" + code + ")";
            }
            

            code = replaces[1] + code + replaces[2];

        }
        
        if (debug) {
            code = "$line=" + thisLine + ";" + code;
        }
        
        // 提取模板中的变量名
        forEach(getVariable(code), function (name) {
            
            // name 值可能为空，在安卓低版本浏览器下
            if (!name || uniq[name]) {
                return;
            }

            var value;

            // 声明模板变量
            // 赋值优先级:
            // [include, print] > utils > helpers > data
            if (name === 'print') {

                value = print;

            } else if (name === 'include') {
                
                value = include;
                
            } else if (utils[name]) {

                value = "$utils." + name;

            } else if (helpers[name]) {

                value = "$helpers." + name;

            } else {

                value = "$data." + name;
            }
            
            headerCode += name + "=" + value + ",";
            uniq[name] = true;
            
            
        });
        
        return code + "\n";
    }
    
    
};



// 定义模板引擎的语法


defaults.openTag = '{{';
defaults.closeTag = '}}';


var filtered = function (js, filter) {
    var parts = filter.split(':');
    var name = parts.shift();
    var args = parts.join(':') || '';

    if (args) {
        args = ', ' + args;
    }

    return '$helpers.' + name + '(' + js + args + ')';
}


defaults.parser = function (code, options) {

    // var match = code.match(/([\w\$]*)(\b.*)/);
    // var key = match[1];
    // var args = match[2];
    // var split = args.split(' ');
    // split.shift();

    code = code.replace(/^\s/, '');

    var split = code.split(' ');
    var key = split.shift();
    var args = split.join(' ');

    

    switch (key) {

        case 'if':

            code = 'if(' + args + '){';
            break;

        case 'else':
            
            if (split.shift() === 'if') {
                split = ' if(' + split.join(' ') + ')';
            } else {
                split = '';
            }

            code = '}else' + split + '{';
            break;

        case '/if':

            code = '}';
            break;

        case 'each':
            
            var object = split[0] || '$data';
            var as     = split[1] || 'as';
            var value  = split[2] || '$value';
            var index  = split[3] || '$index';
            
            var param   = value + ',' + index;
            
            if (as !== 'as') {
                object = '[]';
            }
            
            code =  '$each(' + object + ',function(' + param + '){';
            break;

        case '/each':

            code = '});';
            break;

        case 'echo':

            code = 'print(' + args + ');';
            break;

        case 'print':
        case 'include':

            code = key + '(' + split.join(',') + ');';
            break;

        default:

            // 过滤器（辅助方法）
            // {{value | filterA:'abcd' | filterB}}
            // >>> $helpers.filterB($helpers.filterA(value, 'abcd'))
            // TODO: {{ddd||aaa}} 不包含空格
            if (/^\s*\|\s*[\w\$]/.test(args)) {

                var escape = true;

                // {{#value | link}}
                if (code.indexOf('#') === 0) {
                    code = code.substr(1);
                    escape = false;
                }

                var i = 0;
                var array = code.split('|');
                var len = array.length;
                var val = array[i++];

                for (; i < len; i ++) {
                    val = filtered(val, array[i]);
                }

                code = (escape ? '=' : '=#') + val;

            // 即将弃用 {{helperName value}}
            } else if (template.helpers[key]) {
                
                code = '=#' + key + '(' + split.join(',') + ');';
            
            // 内容直接输出 {{value}}
            } else {

                code = '=' + code;
            }

            break;
    }
    
    
    return code;
};



// RequireJS && SeaJS
if (typeof define === 'function') {
    define(function() {
        return template;
    });

// NodeJS
} else if (typeof exports !== 'undefined') {
    module.exports = template;
} else {
    this.template = template;
}

})();
///<jscompress sourcefile="jquery.validate.js" />
/*!
 * jQuery Validation Plugin 1.11.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright 2013 Jörn Zaefferer
 * Released under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 */

(function($) {

$.extend($.fn, {
	// http://docs.jquery.com/Plugins/Validation/validate
	validate: function( options ) {

		// if nothing is selected, return nothing; can't chain anyway
		if ( !this.length ) {
			if ( options && options.debug && window.console ) {
				console.warn( "Nothing selected, can't validate, returning nothing." );
			}
			return;
		}

		// check if a validator for this form was already created
		var validator = $.data( this[0], "validator" );
		if ( validator ) {
			return validator;
		}

		// Add novalidate tag if HTML5.
		this.attr( "novalidate", "novalidate" );

		validator = new $.validator( options, this[0] );
		$.data( this[0], "validator", validator );

		if ( validator.settings.onsubmit ) {

			this.validateDelegate( ":submit", "click", function( event ) {
				if ( validator.settings.submitHandler ) {
					validator.submitButton = event.target;
				}
				// allow suppressing validation by adding a cancel class to the submit button
				if ( $(event.target).hasClass("cancel") ) {
					validator.cancelSubmit = true;
				}

				// allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
				if ( $(event.target).attr("formnovalidate") !== undefined ) {
					validator.cancelSubmit = true;
				}
			});

			// validate the form on submit
			this.submit( function( event ) {
				if ( validator.settings.debug ) {
					// prevent form submit to be able to see console output
					event.preventDefault();
				}
				function handle() {
					var hidden;
					if ( validator.settings.submitHandler ) {
						if ( validator.submitButton ) {
							// insert a hidden input as a replacement for the missing submit button
							hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val( $(validator.submitButton).val() ).appendTo(validator.currentForm);
						}
						validator.settings.submitHandler.call( validator, validator.currentForm, event );
						if ( validator.submitButton ) {
							// and clean up afterwards; thanks to no-block-scope, hidden can be referenced
							hidden.remove();
						}
						return false;
					}
					return true;
				}

				// prevent submit for invalid forms or custom submit handlers
				if ( validator.cancelSubmit ) {
					validator.cancelSubmit = false;
					return handle();
				}
				if ( validator.form() ) {
					if ( validator.pendingRequest ) {
						validator.formSubmitted = true;
						return false;
					}
					return handle();
				} else {
					validator.focusInvalid();
					return false;
				}
			});
		}

		return validator;
	},
	// http://docs.jquery.com/Plugins/Validation/valid
	valid: function() {
		if ( $(this[0]).is("form")) {
			return this.validate().form();
		} else {
			var valid = true;
			var validator = $(this[0].form).validate();
			this.each(function() {
				valid = valid && validator.element(this);
			});
			return valid;
		}
	},
	// attributes: space seperated list of attributes to retrieve and remove
	removeAttrs: function( attributes ) {
		var result = {},
			$element = this;
		$.each(attributes.split(/\s/), function( index, value ) {
			result[value] = $element.attr(value);
			$element.removeAttr(value);
		});
		return result;
	},
	// http://docs.jquery.com/Plugins/Validation/rules
	rules: function( command, argument ) {
		var element = this[0];

		if ( command ) {
			var settings = $.data(element.form, "validator").settings;
			var staticRules = settings.rules;
			var existingRules = $.validator.staticRules(element);
			switch(command) {
			case "add":
				$.extend(existingRules, $.validator.normalizeRule(argument));
				// remove messages from rules, but allow them to be set separetely
				delete existingRules.messages;
				staticRules[element.name] = existingRules;
				if ( argument.messages ) {
					settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
				}
				break;
			case "remove":
				if ( !argument ) {
					delete staticRules[element.name];
					return existingRules;
				}
				var filtered = {};
				$.each(argument.split(/\s/), function( index, method ) {
					filtered[method] = existingRules[method];
					delete existingRules[method];
				});
				return filtered;
			}
		}

		var data = $.validator.normalizeRules(
		$.extend(
			{},
			$.validator.classRules(element),
			$.validator.attributeRules(element),
			$.validator.dataRules(element),
			$.validator.staticRules(element)
		), element);

		// make sure required is at front
		if ( data.required ) {
			var param = data.required;
			delete data.required;
			data = $.extend({required: param}, data);
		}

		return data;
	}
});

// Custom selectors
$.extend($.expr[":"], {
	// http://docs.jquery.com/Plugins/Validation/blank
	blank: function( a ) { return !$.trim("" + $(a).val()); },
	// http://docs.jquery.com/Plugins/Validation/filled
	filled: function( a ) { return !!$.trim("" + $(a).val()); },
	// http://docs.jquery.com/Plugins/Validation/unchecked
	unchecked: function( a ) { return !$(a).prop("checked"); }
});

// constructor for validator
$.validator = function( options, form ) {
	this.settings = $.extend( true, {}, $.validator.defaults, options );
	this.currentForm = form;
	this.init();
};

$.validator.format = function( source, params ) {
	if ( arguments.length === 1 ) {
		return function() {
			var args = $.makeArray(arguments);
			args.unshift(source);
			return $.validator.format.apply( this, args );
		};
	}
	if ( arguments.length > 2 && params.constructor !== Array  ) {
		params = $.makeArray(arguments).slice(1);
	}
	if ( params.constructor !== Array ) {
		params = [ params ];
	}
	$.each(params, function( i, n ) {
		source = source.replace( new RegExp("\\{" + i + "\\}", "g"), function() {
			return n;
		});
	});
	return source;
};

$.extend($.validator, {

	defaults: {
		messages: {},
		groups: {},
		rules: {},
		errorClass: "error",
		validClass: "valid",
		errorElement: "label",
		focusInvalid: true,
		errorContainer: $([]),
		errorLabelContainer: $([]),
		onsubmit: true,
		ignore: ":hidden",
		ignoreTitle: false,
		onfocusin: function( element, event ) {
			this.lastActive = element;

			// hide error label and remove error class on focus if enabled
			if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
				if ( this.settings.unhighlight ) {
					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
				}
				this.addWrapper(this.errorsFor(element)).hide();
			}
		},
		onfocusout: function( element, event ) {
			if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
				this.element(element);
			}
		},
		onkeyup: function( element, event ) {
			if ( event.which === 9 && this.elementValue(element) === "" ) {
				return;
			} else if ( element.name in this.submitted || element === this.lastElement ) {
				this.element(element);
			}
		},
		onclick: function( element, event ) {
			// click on selects, radiobuttons and checkboxes
			if ( element.name in this.submitted ) {
				this.element(element);
			}
			// or option elements, check parent select in that case
			else if ( element.parentNode.name in this.submitted ) {
				this.element(element.parentNode);
			}
		},
		highlight: function( element, errorClass, validClass ) {
			if ( element.type === "radio" ) {
				this.findByName(element.name).addClass(errorClass).removeClass(validClass);
			} else {
				$(element).addClass(errorClass).removeClass(validClass);
			}
		},
		unhighlight: function( element, errorClass, validClass ) {
			if ( element.type === "radio" ) {
				this.findByName(element.name).removeClass(errorClass).addClass(validClass);
			} else {
				$(element).removeClass(errorClass).addClass(validClass);
			}
		}
	},

	// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
	setDefaults: function( settings ) {
		$.extend( $.validator.defaults, settings );
	},

	messages: {
		required: "This field is required.",
		remote: "Please fix this field.",
		email: "Please enter a valid email address.",
		url: "Please enter a valid URL.",
		date: "Please enter a valid date.",
		dateISO: "Please enter a valid date (ISO).",
		number: "Please enter a valid number.",
		digits: "Please enter only digits.",
		creditcard: "Please enter a valid credit card number.",
		equalTo: "Please enter the same value again.",
		maxlength: $.validator.format("Please enter no more than {0} characters."),
		minlength: $.validator.format("Please enter at least {0} characters."),
		rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
		range: $.validator.format("Please enter a value between {0} and {1}."),
		max: $.validator.format("Please enter a value less than or equal to {0}."),
		min: $.validator.format("Please enter a value greater than or equal to {0}.")
	},

	autoCreateRanges: false,

	prototype: {

		init: function() {
			this.labelContainer = $(this.settings.errorLabelContainer);
			this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
			this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
			this.submitted = {};
			this.valueCache = {};
			this.pendingRequest = 0;
			this.pending = {};
			this.invalid = {};
			this.reset();

			var groups = (this.groups = {});
			$.each(this.settings.groups, function( key, value ) {
				if ( typeof value === "string" ) {
					value = value.split(/\s/);
				}
				$.each(value, function( index, name ) {
					groups[name] = key;
				});
			});
			var rules = this.settings.rules;
			$.each(rules, function( key, value ) {
				rules[key] = $.validator.normalizeRule(value);
			});

			function delegate(event) {
				var validator = $.data(this[0].form, "validator"),
					eventType = "on" + event.type.replace(/^validate/, "");
				if ( validator.settings[eventType] ) {
					validator.settings[eventType].call(validator, this[0], event);
				}
			}
			$(this.currentForm)
				.validateDelegate(":text, [type='password'], [type='file'], select, textarea, " +
					"[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
					"[type='email'], [type='datetime'], [type='date'], [type='month'], " +
					"[type='week'], [type='time'], [type='datetime-local'], " +
					"[type='range'], [type='color'] ",
					"focusin focusout keyup", delegate)
				.validateDelegate("[type='radio'], [type='checkbox'], select, option", "click", delegate);

			if ( this.settings.invalidHandler ) {
				$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
			}
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/form
		form: function() {
			this.checkForm();
			$.extend(this.submitted, this.errorMap);
			this.invalid = $.extend({}, this.errorMap);
			if ( !this.valid() ) {
				$(this.currentForm).triggerHandler("invalid-form", [this]);
			}
			this.showErrors();
			return this.valid();
		},

		checkForm: function() {
			this.prepareForm();
			for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
				this.check( elements[i] );
			}
			return this.valid();
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/element
		element: function( element ) {
			element = this.validationTargetFor( this.clean( element ) );
			this.lastElement = element;
			this.prepareElement( element );
			this.currentElements = $(element);
			var result = this.check( element ) !== false;
			if ( result ) {
				delete this.invalid[element.name];
			} else {
				this.invalid[element.name] = true;
			}
			if ( !this.numberOfInvalids() ) {
				// Hide error containers on last error
				this.toHide = this.toHide.add( this.containers );
			}
			this.showErrors();
			return result;
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/showErrors
		showErrors: function( errors ) {
			if ( errors ) {
				// add items to error list and map
				$.extend( this.errorMap, errors );
				this.errorList = [];
				for ( var name in errors ) {
					this.errorList.push({
						message: errors[name],
						element: this.findByName(name)[0]
					});
				}
				// remove items from success list
				this.successList = $.grep( this.successList, function( element ) {
					return !(element.name in errors);
				});
			}
			if ( this.settings.showErrors ) {
				this.settings.showErrors.call( this, this.errorMap, this.errorList );
			} else {
				this.defaultShowErrors();
			}
		},

		// http://docs.jquery.com/Plugins/Validation/Validator/resetForm
		resetForm: function() {
			if ( $.fn.resetForm ) {
				$(this.currentForm).resetForm();
			}
			this.submitted = {};
			this.lastElement = null;
			this.prepareForm();
			this.hideErrors();
			this.elements().removeClass( this.settings.errorClass ).removeData( "previousValue" );
		},

		numberOfInvalids: function() {
			return this.objectLength(this.invalid);
		},

		objectLength: function( obj ) {
			var count = 0;
			for ( var i in obj ) {
				count++;
			}
			return count;
		},

		hideErrors: function() {
			this.addWrapper( this.toHide ).hide();
		},

		valid: function() {
			return this.size() === 0;
		},

		size: function() {
			return this.errorList.length;
		},

		focusInvalid: function() {
			if ( this.settings.focusInvalid ) {
				try {
					$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
					.filter(":visible")
					.focus()
					// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
					.trigger("focusin");
				} catch(e) {
					// ignore IE throwing errors when focusing hidden elements
				}
			}
		},

		findLastActive: function() {
			var lastActive = this.lastActive;
			return lastActive && $.grep(this.errorList, function( n ) {
				return n.element.name === lastActive.name;
			}).length === 1 && lastActive;
		},

		elements: function() {
			var validator = this,
				rulesCache = {};

			// select all valid inputs inside the form (no submit or reset buttons)
			return $(this.currentForm)
			.find("input, select, textarea")
			.not(":submit, :reset, :image, [disabled]")
			.not( this.settings.ignore )
			.filter(function() {
				if ( !this.name && validator.settings.debug && window.console ) {
					console.error( "%o has no name assigned", this);
				}

				// select only the first element for each name, and only those with rules specified
				if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
					return false;
				}

				rulesCache[this.name] = true;
				return true;
			});
		},

		clean: function( selector ) {
			return $(selector)[0];
		},

		errors: function() {
			var errorClass = this.settings.errorClass.replace(" ", ".");
			return $(this.settings.errorElement + "." + errorClass, this.errorContext);
		},

		reset: function() {
			this.successList = [];
			this.errorList = [];
			this.errorMap = {};
			this.toShow = $([]);
			this.toHide = $([]);
			this.currentElements = $([]);
		},

		prepareForm: function() {
			this.reset();
			this.toHide = this.errors().add( this.containers );
		},

		prepareElement: function( element ) {
			this.reset();
			this.toHide = this.errorsFor(element);
		},

		elementValue: function( element ) {
			var type = $(element).attr("type"),
				val = $(element).val();

			if ( type === "radio" || type === "checkbox" ) {
				return $("input[name='" + $(element).attr("name") + "']:checked").val();
			}

			if ( typeof val === "string" ) {
				return val.replace(/\r/g, "");
			}
			return val;
		},

		check: function( element ) {
			element = this.validationTargetFor( this.clean( element ) );

			var rules = $(element).rules();
			var dependencyMismatch = false;
			var val = this.elementValue(element);
			var result;

			for (var method in rules ) {
				var rule = { method: method, parameters: rules[method] };
				try {

					result = $.validator.methods[method].call( this, val, element, rule.parameters );

					// if a method indicates that the field is optional and therefore valid,
					// don't mark it as valid when there are no other rules
					if ( result === "dependency-mismatch" ) {
						dependencyMismatch = true;
						continue;
					}
					dependencyMismatch = false;

					if ( result === "pending" ) {
						this.toHide = this.toHide.not( this.errorsFor(element) );
						return;
					}

					if ( !result ) {
						this.formatAndAdd( element, rule );
						return false;
					}
				} catch(e) {
					if ( this.settings.debug && window.console ) {
						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
					}
					throw e;
				}
			}
			if ( dependencyMismatch ) {
				return;
			}
			if ( this.objectLength(rules) ) {
				this.successList.push(element);
			}
			return true;
		},

		// return the custom message for the given element and validation method
		// specified in the element's HTML5 data attribute
		customDataMessage: function( element, method ) {
			return $(element).data("msg-" + method.toLowerCase()) || (element.attributes && $(element).attr("data-msg-" + method.toLowerCase()));
		},

		// return the custom message for the given element name and validation method
		customMessage: function( name, method ) {
			var m = this.settings.messages[name];
			return m && (m.constructor === String ? m : m[method]);
		},

		// return the first defined argument, allowing empty strings
		findDefined: function() {
			for(var i = 0; i < arguments.length; i++) {
				if ( arguments[i] !== undefined ) {
					return arguments[i];
				}
			}
			return undefined;
		},

		defaultMessage: function( element, method ) {
			return this.findDefined(
				this.customMessage( element.name, method ),
				this.customDataMessage( element, method ),
				// title is never undefined, so handle empty string as undefined
				!this.settings.ignoreTitle && element.title || undefined,
				$.validator.messages[method],
				"<strong>Warning: No message defined for " + element.name + "</strong>"
			);
		},

		formatAndAdd: function( element, rule ) {
			var message = this.defaultMessage( element, rule.method ),
				theregex = /\$?\{(\d+)\}/g;
			if ( typeof message === "function" ) {
				message = message.call(this, rule.parameters, element);
			} else if (theregex.test(message)) {
				message = $.validator.format(message.replace(theregex, "{$1}"), rule.parameters);
			}
			this.errorList.push({
				message: message,
				element: element
			});

			this.errorMap[element.name] = message;
			this.submitted[element.name] = message;
		},

		addWrapper: function( toToggle ) {
			if ( this.settings.wrapper ) {
				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
			}
			return toToggle;
		},

		defaultShowErrors: function() {
			var i, elements;
			for ( i = 0; this.errorList[i]; i++ ) {
				var error = this.errorList[i];
				if ( this.settings.highlight ) {
					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
				}
				this.showLabel( error.element, error.message );
			}
			if ( this.errorList.length ) {
				this.toShow = this.toShow.add( this.containers );
			}
			if ( this.settings.success ) {
				for ( i = 0; this.successList[i]; i++ ) {
					this.showLabel( this.successList[i] );
				}
			}
			if ( this.settings.unhighlight ) {
				for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
					this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
				}
			}
			this.toHide = this.toHide.not( this.toShow );
			this.hideErrors();
			this.addWrapper( this.toShow ).show();
		},

		validElements: function() {
			return this.currentElements.not(this.invalidElements());
		},

		invalidElements: function() {
			return $(this.errorList).map(function() {
				return this.element;
			});
		},

		showLabel: function( element, message ) {
			var label = this.errorsFor( element );
			if ( label.length ) {
				// refresh error/success class
				label.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
				// replace message on existing label
				label.html(message);
			} else {
				// create label
				label = $("<" + this.settings.errorElement + ">")
					.attr("for", this.idOrName(element))
					.addClass(this.settings.errorClass)
					.html(message || "");
				if ( this.settings.wrapper ) {
					// make sure the element is visible, even in IE
					// actually showing the wrapped element is handled elsewhere
					label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
				}
				if ( !this.labelContainer.append(label).length ) {
					if ( this.settings.errorPlacement ) {
						this.settings.errorPlacement(label, $(element) );
					} else {
						label.insertAfter(element);
					}
				}
			}
			if ( !message && this.settings.success ) {
				label.text("");
				if ( typeof this.settings.success === "string" ) {
					label.addClass( this.settings.success );
				} else {
					this.settings.success( label, element );
				}
			}
			this.toShow = this.toShow.add(label);
		},

		errorsFor: function( element ) {
			var name = this.idOrName(element);
			return this.errors().filter(function() {
				return $(this).attr("for") === name;
			});
		},

		idOrName: function( element ) {
			return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
		},

		validationTargetFor: function( element ) {
			// if radio/checkbox, validate first element in group instead
			if ( this.checkable(element) ) {
				element = this.findByName( element.name ).not(this.settings.ignore)[0];
			}
			return element;
		},

		checkable: function( element ) {
			return (/radio|checkbox/i).test(element.type);
		},

		findByName: function( name ) {
			return $(this.currentForm).find("[name='" + name + "']");
		},

		getLength: function( value, element ) {
			switch( element.nodeName.toLowerCase() ) {
			case "select":
				return $("option:selected", element).length;
			case "input":
				if ( this.checkable( element) ) {
					return this.findByName(element.name).filter(":checked").length;
				}
			}
			return value.length;
		},

		depend: function( param, element ) {
			return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;
		},

		dependTypes: {
			"boolean": function( param, element ) {
				return param;
			},
			"string": function( param, element ) {
				return !!$(param, element.form).length;
			},
			"function": function( param, element ) {
				return param(element);
			}
		},

		optional: function( element ) {
			var val = this.elementValue(element);
			return !$.validator.methods.required.call(this, val, element) && "dependency-mismatch";
		},

		startRequest: function( element ) {
			if ( !this.pending[element.name] ) {
				this.pendingRequest++;
				this.pending[element.name] = true;
			}
		},

		stopRequest: function( element, valid ) {
			this.pendingRequest--;
			// sometimes synchronization fails, make sure pendingRequest is never < 0
			if ( this.pendingRequest < 0 ) {
				this.pendingRequest = 0;
			}
			delete this.pending[element.name];
			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
				$(this.currentForm).submit();
				this.formSubmitted = false;
			} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {
				$(this.currentForm).triggerHandler("invalid-form", [this]);
				this.formSubmitted = false;
			}
		},

		previousValue: function( element ) {
			return $.data(element, "previousValue") || $.data(element, "previousValue", {
				old: null,
				valid: true,
				message: this.defaultMessage( element, "remote" )
			});
		}

	},

	classRuleSettings: {
		required: {required: true},
		email: {email: true},
		url: {url: true},
		date: {date: true},
		dateISO: {dateISO: true},
		number: {number: true},
		digits: {digits: true},
		creditcard: {creditcard: true}
	},

	addClassRules: function( className, rules ) {
		if ( className.constructor === String ) {
			this.classRuleSettings[className] = rules;
		} else {
			$.extend(this.classRuleSettings, className);
		}
	},

	classRules: function( element ) {
		var rules = {};
		var classes = $(element).attr("class");
		if ( classes ) {
			$.each(classes.split(" "), function() {
				if ( this in $.validator.classRuleSettings ) {
					$.extend(rules, $.validator.classRuleSettings[this]);
				}
			});
		}
		return rules;
	},

	attributeRules: function( element ) {
		var rules = {};
		var $element = $(element);
		var type = $element[0].getAttribute("type");

		for (var method in $.validator.methods) {
			var value;

			// support for <input required> in both html5 and older browsers
			if ( method === "required" ) {
				value = $element.get(0).getAttribute(method);
				// Some browsers return an empty string for the required attribute
				// and non-HTML5 browsers might have required="" markup
				if ( value === "" ) {
					value = true;
				}
				// force non-HTML5 browsers to return bool
				value = !!value;
			} else {
				value = $element.attr(method);
			}

			// convert the value to a number for number inputs, and for text for backwards compability
			// allows type="date" and others to be compared as strings
			if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
				value = Number(value);
			}

			if ( value ) {
				rules[method] = value;
			} else if ( type === method && type !== 'range' ) {
				// exception: the jquery validate 'range' method
				// does not test for the html5 'range' type
				rules[method] = true;
			}
		}

		// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
		if ( rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength) ) {
			delete rules.maxlength;
		}

		return rules;
	},

	dataRules: function( element ) {
		var method, value,
			rules = {}, $element = $(element);
		for (method in $.validator.methods) {
			value = $element.data("rule-" + method.toLowerCase());
			if ( value !== undefined ) {
				rules[method] = value;
			}
		}
		return rules;
	},

	staticRules: function( element ) {
		var rules = {};
		var validator = $.data(element.form, "validator");
		if ( validator.settings.rules ) {
			rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
		}
		return rules;
	},

	normalizeRules: function( rules, element ) {
		// handle dependency check
		$.each(rules, function( prop, val ) {
			// ignore rule when param is explicitly false, eg. required:false
			if ( val === false ) {
				delete rules[prop];
				return;
			}
			if ( val.param || val.depends ) {
				var keepRule = true;
				switch (typeof val.depends) {
				case "string":
					keepRule = !!$(val.depends, element.form).length;
					break;
				case "function":
					keepRule = val.depends.call(element, element);
					break;
				}
				if ( keepRule ) {
					rules[prop] = val.param !== undefined ? val.param : true;
				} else {
					delete rules[prop];
				}
			}
		});

		// evaluate parameters
		$.each(rules, function( rule, parameter ) {
			rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
		});

		// clean number parameters
		$.each(['minlength', 'maxlength'], function() {
			if ( rules[this] ) {
				rules[this] = Number(rules[this]);
			}
		});
		$.each(['rangelength', 'range'], function() {
			var parts;
			if ( rules[this] ) {
				if ( $.isArray(rules[this]) ) {
					rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
				} else if ( typeof rules[this] === "string" ) {
					parts = rules[this].split(/[\s,]+/);
					rules[this] = [Number(parts[0]), Number(parts[1])];
				}
			}
		});

		if ( $.validator.autoCreateRanges ) {
			// auto-create ranges
			if ( rules.min && rules.max ) {
				rules.range = [rules.min, rules.max];
				delete rules.min;
				delete rules.max;
			}
			if ( rules.minlength && rules.maxlength ) {
				rules.rangelength = [rules.minlength, rules.maxlength];
				delete rules.minlength;
				delete rules.maxlength;
			}
		}

		return rules;
	},

	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
	normalizeRule: function( data ) {
		if ( typeof data === "string" ) {
			var transformed = {};
			$.each(data.split(/\s/), function() {
				transformed[this] = true;
			});
			data = transformed;
		}
		return data;
	},

	// http://docs.jquery.com/Plugins/Validation/Validator/addMethod
	addMethod: function( name, method, message ) {
		$.validator.methods[name] = method;
		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
		if ( method.length < 3 ) {
			$.validator.addClassRules(name, $.validator.normalizeRule(name));
		}
	},

	methods: {

		// http://docs.jquery.com/Plugins/Validation/Methods/required
		required: function( value, element, param ) {
			// check if dependency is met
			if ( !this.depend(param, element) ) {
				return "dependency-mismatch";
			}
			if ( element.nodeName.toLowerCase() === "select" ) {
				// could be an array for select-multiple or a string, both are fine this way
				var val = $(element).val();
				return val && val.length > 0;
			}
			if ( this.checkable(element) ) {
				return this.getLength(value, element) > 0;
			}
			return $.trim(value).length > 0;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/email
		email: function( value, element ) {
			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
			return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/url
		url: function( value, element ) {
			// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
			return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/date
		date: function( value, element ) {
			return this.optional(element) || !/Invalid|NaN/.test(new Date(value).toString());
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/dateISO
		dateISO: function( value, element ) {
			return this.optional(element) || /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/number
		number: function( value, element ) {
			return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/digits
		digits: function( value, element ) {
			return this.optional(element) || /^\d+$/.test(value);
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/creditcard
		// based on http://en.wikipedia.org/wiki/Luhn
		creditcard: function( value, element ) {
			if ( this.optional(element) ) {
				return "dependency-mismatch";
			}
			// accept only spaces, digits and dashes
			if ( /[^0-9 \-]+/.test(value) ) {
				return false;
			}
			var nCheck = 0,
				nDigit = 0,
				bEven = false;

			value = value.replace(/\D/g, "");

			for (var n = value.length - 1; n >= 0; n--) {
				var cDigit = value.charAt(n);
				nDigit = parseInt(cDigit, 10);
				if ( bEven ) {
					if ( (nDigit *= 2) > 9 ) {
						nDigit -= 9;
					}
				}
				nCheck += nDigit;
				bEven = !bEven;
			}

			return (nCheck % 10) === 0;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/minlength
		minlength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || length >= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/maxlength
		maxlength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || length <= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/rangelength
		rangelength: function( value, element, param ) {
			var length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);
			return this.optional(element) || ( length >= param[0] && length <= param[1] );
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/min
		min: function( value, element, param ) {
			return this.optional(element) || value >= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/max
		max: function( value, element, param ) {
			return this.optional(element) || value <= param;
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/range
		range: function( value, element, param ) {
			return this.optional(element) || ( value >= param[0] && value <= param[1] );
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/equalTo
		equalTo: function( value, element, param ) {
			// bind to the blur event of the target in order to revalidate whenever the target field is updated
			// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
			var target = $(param);
			if ( this.settings.onfocusout ) {
				target.unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
					$(element).valid();
				});
			}
			return value === target.val();
		},

		// http://docs.jquery.com/Plugins/Validation/Methods/remote
		remote: function( value, element, param ) {
			if ( this.optional(element) ) {
				return "dependency-mismatch";
			}

			var previous = this.previousValue(element);
			if (!this.settings.messages[element.name] ) {
				this.settings.messages[element.name] = {};
			}
			previous.originalMessage = this.settings.messages[element.name].remote;
			this.settings.messages[element.name].remote = previous.message;
			param = typeof param === "string" && {url:param} || param;

			if ( previous.old === value ) {
				return previous.valid;
			}

			previous.old = value;
			var validator = this;
			this.startRequest(element);
			var data = {};
			data[element.name] = value;
			var tempData = {};
			if(typeof param.url === 'function'){
				tempData.url = param.url();
			}
			if(typeof param.data === 'function'){
				tempData.data = param.data();
			}
			$.ajax($.extend(true, {
				url: param,
				mode: "abort",
				port: "validate" + element.name,
				dataType: "json",
				data: data,
				filter:null,
				success: function( response ) {
					validator.settings.messages[element.name].remote = previous.originalMessage;
					if(typeof this.filter === 'function'){
						response = this.filter(response);
					}
					var valid = response === true || response === "true";
					if ( valid ) {
						var submitted = validator.formSubmitted;
						validator.prepareElement(element);
						validator.formSubmitted = submitted;
						validator.successList.push(element);
						delete validator.invalid[element.name];
						validator.showErrors();
					} else {
						var errors = {};
						var message = response || validator.defaultMessage( element, "remote" );
						errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
						validator.invalid[element.name] = true;
						validator.showErrors(errors);
					}
					previous.valid = valid;
					validator.stopRequest(element, valid);
				}
			}, param, tempData));
			return "pending";
		}

	}

});

// deprecated, use $.validator.format instead
$.format = $.validator.format;

}(jQuery));

// ajax mode: abort
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
(function($) {
	var pendingRequests = {};
	// Use a prefilter if available (1.5+)
	if ( $.ajaxPrefilter ) {
		$.ajaxPrefilter(function( settings, _, xhr ) {
			var port = settings.port;
			if ( settings.mode === "abort" ) {
				if ( pendingRequests[port] ) {
					pendingRequests[port].abort();
				}
				pendingRequests[port] = xhr;
			}
		});
	} else {
		// Proxy ajax
		var ajax = $.ajax;
		$.ajax = function( settings ) {
			var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
				port = ( "port" in settings ? settings : $.ajaxSettings ).port;
			if ( mode === "abort" ) {
				if ( pendingRequests[port] ) {
					pendingRequests[port].abort();
				}
				pendingRequests[port] = ajax.apply(this, arguments);
				return pendingRequests[port];
			}
			return ajax.apply(this, arguments);
		};
	}
}(jQuery));

// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
(function($) {
	$.extend($.fn, {
		validateDelegate: function( delegate, type, handler ) {
			return this.bind(type, function( event ) {
				var target = $(event.target);
				if ( target.is(delegate) ) {
					return handler.apply(target, arguments);
				}
			});
		}
	});
}(jQuery));

